def add_test(url: str = None, headers: dict = None, project_id: str = None, story_key: str = None, test_description: str = None, test_name: str = None, test_type: str = None): """ Create a Jira "test" entry related to a project and story TODO work on the customfield as it may vary with the jira setting :param url: the jira server url without endpoint :param headers: the request headers :param project_id: the project id not the project key :param story_key: the story key the test is related to :param test_description: the test description :param test_name: the test name :param test_type: the test type (Manual, Cucumber, Generic) :return: the create link response and the test key """ data = { "fields": { "project": { "id": str(project_id) }, "summary": test_name, "description": "", "issuetype": { "id": str( JiraIssue.get_issue_identifier( url=url, headers=headers, issue_type=JiraTests.TEST)) }, "customfield_10202": { "value": "Cucumber" }, "customfield_10203": { "value": str(test_type) }, "customfield_10204": test_description } } response = JiraIssue.create_issue(url=url, headers=headers, issue_data=data) key = response.json()["key"] response = JiraIssue.create_link(url=url, headers=headers, from_key=key, to_key=story_key, link_type="Tests") return response, key
def create_link(self, from_key=None, to_key=None, link_type=None): return JiraIssue.create_link(url=self.url, headers=self.header(), from_key=from_key, to_key=to_key, link_type=link_type)