Exemplo n.º 1
0
    def search(self,
               jql_query: str = None,
               field_list: list = None,
               paginated: bool = True):
        assert isinstance(jql_query, str), "jql_query must be a string"
        assert isinstance(field_list, list), "field_list must be a list"
        assert all([isinstance(field, str) for field in field_list]), \
            "all fields in the field_list must be a string"
        assert isinstance(paginated,
                          bool), "paginated is a boolean True or False"

        if paginated:
            return JiraIssue.search(url=self.url,
                                    headers=self.header(),
                                    search_request={
                                        'jql': jql_query,
                                        'fields': field_list
                                    })
        else:
            return JiraIssue.search_issues(url=self.url,
                                           headers=self.header(),
                                           search_request={
                                               'jql': jql_query,
                                               'fields': field_list
                                           })
Exemplo n.º 2
0
 def get_epics(url=None, headers=None, project_id=None):
     """
     Get all epics related to a project
     :return: a list of key-epic name sets
     """
     data = {"jql": "project = {} AND type = Epic".format(project_id),
             "fields": ["key", "customfield_10004"]}
     list_rep = []
     response = JiraIssue.search_issues(url=url, headers=headers, search_request=data)
     issues = response.json()["issues"]
     for item in issues:
         list_rep.append((item["key"], item["fields"]["customfield_10004"]))
     return list_rep
Exemplo n.º 3
0
    def get_test_plan_in_release(url: str = None,
                                 headers: dict = None,
                                 release_name: str = None):
        """

        :param url: the jira server url without endpoint
        :param headers: the request headers
        :param release_name: the release name
        :return: a dictionary containing the key "issues" which value is a list of test plan key
        in a dictionary i.e.
        can be acceded with return_var["issues"][position]["key"]
        """
        data = {
            "jql":
            'fixVersion="{}" AND issueType = "Test Plan"'.format(release_name),
            "fields": [
                "key",
            ]
        }

        return JiraIssue.search_issues(url=url,
                                       headers=headers,
                                       search_request=data)