Skip to content

Commit 1dd170b

Browse files
committed
Add jira server support
1 parent 6ace1bc commit 1dd170b

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ JiraConnector.download_features(
2828
secret_key='ASSERTTHAT_SECRET_KEY',
2929
# Optional - default ./features
3030
output_folder='./features',
31+
#Required for Jira Server only. Omit if using Jira Cloud version
32+
jira_server_url: 'https://mycompanyjira.com'
3133
# Optional - all features downloaded by default - should be a valid JQL
3234
# jql = 'project = XX AND key in ('XXX-1')',
3335
# Optional - default automated (can be one of: manual/automated/both)
@@ -50,6 +52,8 @@ JiraConnector.upload_report(
5052
secret_key='ASSERTTHAT_SECRET_KEY',
5153
# The name of the run - default 'Test run dd MMM yyyy HH:mm:ss'
5254
run_name= 'Dry Tests Run',
55+
#Required for Jira Server only. Omit if using Jira Cloud version
56+
jira_server_url: 'https://mycompanyjira.com'
5357
# Json report folder - default ./reports
5458
json_report_folder='./reports',
5559
# Regex to search for cucumber reports - default "\.json$"

assertthat_bdd/jira_integration.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class JiraConnector:
1010

11-
def download_features(project_id, access_key=None, secret_key=None, output_folder='./features/', jql=None, mode='automated',
11+
def download_features(project_id, access_key=None, secret_key=None, output_folder='./features/', jql=None, mode='automated', jira_server_url=None,
1212
proxy_uri=None, proxy_username=None, proxy_password=None):
1313

1414
if access_key is None:
@@ -23,7 +23,10 @@ def download_features(project_id, access_key=None, secret_key=None, output_folde
2323
else:
2424
secret_key = os.environ.get("ASSERTTHAT_SECRET_KEY")
2525

26-
path = 'https://bdd.assertthat.app/rest/api/1/project/' + project_id + '/features'
26+
if jira_server_url is None:
27+
path = 'https://bdd.assertthat.app/rest/api/1/project/' + project_id + '/features'
28+
else:
29+
path = jira_server_url+"/rest/assertthat/latest/project/" + project_id + "/client/features"
2730
headers = {}
2831
payload = {'mode': mode,
2932
'jql': jql
@@ -67,10 +70,13 @@ def download_features(project_id, access_key=None, secret_key=None, output_folde
6770

6871
def upload_report(project_id, access_key, secret_key,
6972
run_name='Test run ' + datetime.datetime.now().strftime("%d %b %Y %H:%M:%S"),
70-
json_report_folder='./reports/', json_report_include_pattern='\.json$', type='cucumber',
73+
json_report_folder='./reports/', json_report_include_pattern='\.json$', type='cucumber', jira_server_url=None,
7174
proxy_uri=None, proxy_username=None, proxy_password=None):
7275

73-
path = 'https://bdd.assertthat.app/rest/api/1/project/' + project_id + '/report'
76+
if jira_server_url is None:
77+
path = 'https://bdd.assertthat.app/rest/api/1/project/' + project_id + '/report'
78+
else:
79+
path = jira_server_url + "/rest/assertthat/latest/project/" + project_id + "/client/report"
7480

7581
if proxy_uri is None:
7682
proxies = None

0 commit comments

Comments
 (0)