Ejemplo n.º 1
0
 def create_issue(self, issue_data: dict = None):
     """
     Create a new issue in the project.
     :param issue_data:
     :return: a request response
     """
     return JiraIssue.create_issue(url=self.url,
                                   headers=self.header(),
                                   issue_data=issue_data)
Ejemplo n.º 2
0
    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
Ejemplo n.º 3
0
 def create_story(url=None,
                  headers=None,
                  project_id=None,
                  title=None,
                  description=None,
                  epic_key=None,
                  actor=None,
                  action=None,
                  benefit=None):
     """
     Request the creation of a story
     :param project_id:
     :param headers:
     :param url:
     :param action:
     :param benefit:
     :param actor:
     :param epic_key:
     :param title:
     :param description:
     :return: request response
     """
     data = {
         "fields": {
             "project": {
                 "id": str(project_id)
             },
             "summary": title,
             "issuetype": {
                 "id":
                 str(
                     JiraIssue.get_issue_identifier(
                         url=url,
                         headers=headers,
                         issue_type=JiraStories.STORY))
             },
             "description": description,
             "customfield_10002": epic_key,
             JiraStories.ROLE_JIRA_KEY: actor,
             JiraStories.ACTION_JIRA_KEY: action,
             JiraStories.BENEFIT_JIRA_KEY: benefit
         }
     }
     return JiraIssue.create_issue(url=url,
                                   headers=headers,
                                   issue_data=data)
Ejemplo n.º 4
0
 def add_epic(url=None, headers=None, project_id=None, epic_name=None, epic_summary=None):
     data = {"fields": {"project": {"id": str(project_id)},
                        "summary": epic_summary,
                        "issuetype": {"id": str(JiraIssue.get_issue_identifier(issue_type=JiraEpics.EPIC))},  # noqa
                        "customfield_10004": epic_name}}
     return JiraIssue.create_issue(url=url, headers=headers, issue_data=data)