Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def create_issue_open_quick_create():
r = locust.client.post('/secure/QuickCreateIssue!default.jspa?decorator=none',
ADMIN_HEADERS, catch_response=True)
content = r.content.decode('utf-8')
atl_token = fetch_by_re(params.atl_token_pattern, content)
form_token = fetch_by_re(params.form_token_pattern, content)
issue_type = fetch_by_re(params.issue_type_pattern, content)
resolution_done = fetch_by_re(params.resolution_done_pattern, content)
fields_to_retain = re.findall(params.fields_to_retain_pattern, content)
custom_fields_to_retain = re.findall(params.custom_fields_to_retain_pattern, content)
issue_body_params_dict = {'atl_token': atl_token,
'form_token': form_token,
'issue_type': issue_type,
'project_id': project_id,
'resolution_done': resolution_done,
'fields_to_retain': fields_to_retain,
'custom_fields_to_retain': custom_fields_to_retain
}
fields_to_retain = re.findall(params.fields_to_retain_pattern, content)
custom_fields_to_retain = re.findall(params.custom_fields_to_retain_pattern, content)
issue_body_params_dict = {'atl_token': atl_token,
'form_token': form_token,
'issue_type': issue_type,
'project_id': project_id,
'resolution_done': resolution_done,
'fields_to_retain': fields_to_retain,
'custom_fields_to_retain': custom_fields_to_retain
}
if not ('"id":"project","label":"Project"' in content):
logger.error(f'{params.err_message_create_issue}: {content}')
assert '"id":"project","label":"Project"' in content, params.err_message_create_issue
locust.client.post('/rest/quickedit/1.0/userpreferences/create', params.user_preferences_payload,
ADMIN_HEADERS, catch_response=True)
locust.storage['issue_body_params_dict'] = issue_body_params_dict
create_issue_open_quick_create()
def create_issue_submit_form():
issue_body = params.prepare_issue_body(locust.storage['issue_body_params_dict'], user=locust.user)
r = locust.client.post('/secure/QuickCreateIssue.jspa?decorator=none', params=issue_body,
headers=ADMIN_HEADERS, catch_response=True)
content = r.content.decode('utf-8')
if not ('"id":"project","label":"Project"') in content:
logger.error(f'{params.err_message_create_issue}: {content}')
assert '"id":"project","label":"Project"' in content, params.err_message_create_issue
issue_key = fetch_by_re(params.create_issue_key_pattern, content)
logger.locust_info(f"{params.action_name}: Issue {issue_key} was successfully created")
create_issue_submit_form()