def configure_suspect(host_url, username, password, project_key, fields_list, link_type_id, scope, notify_assignee,
notify_reporter, notify_project_lead, notify_user_list):
"""
This method is used to configure the Requirements Suspect Configuration
Query parameters:
[project_key] the project key
Query parameters:
[fields_list] fields that trigger a suspect
[link_type_id] link types that should be affected if a field change
[scope] define if a change in an issue will trigger suspect. Accepts 'both' or 'downstream'
[notify_assignee] notify assignee if set to true
[notify_reporter] notify reporter if set to true
[notify_project_lead] notify project lead if set to true
[notify_user_list] the jira users to be notified
"""
# The REST API path to configure the Requirements Suspect Configuration
path_uri = '/rest/com.easesolutions.jira.plugins.requirements/1.0/' + project_key + '/suspectconfiguration?'
# The query string to be added to the URI
query_string = ""
# The field-value pair/s for the query string of the URI
if fields_list:
query_string += 'fieldList=' + fields_list
if link_type_id:
if query_string:
query_string += '&linkTypeIds=' + link_type_id
else:
query_string += 'linkTypeIds=' + link_type_id
if scope:
if query_string:
query_string += '&scope=' + scope
else:
query_string += 'scope=' + scope
if notify_assignee:
if query_string:
query_string += '¬ifyAssignee=' + notify_assignee
else:
query_string += 'notifyAssignee=' + notify_assignee
if notify_reporter:
if query_string:
query_string += '¬ifyReporter=' + notify_reporter
else:
query_string += 'notifyReporter=' + notify_reporter
if notify_project_lead:
if query_string:
query_string += '¬ifyProjectLead=' + notify_project_lead
else:
query_string += 'notifyProjectLead=' + notify_project_lead
if notify_user_list:
if query_string:
query_string += '¬ifyUserList=' + notify_user_list
else:
query_string += 'notifyUserList=' + notify_user_list
# Send a PUT request to configure the Requirements Suspect Configuration
# Return the result of the PUT request
try:
return requests.put(host_url + path_uri + query_string, auth=HTTPBasicAuth(username, password))
except requests.exceptions.RequestException as e:
print e |