-
-
Notifications
You must be signed in to change notification settings - Fork 879
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue Field and Issue Type object based methods (#1784)
* Provide page-aware access to createmeta issuetypes Version 3.5.0 of the client library introduced the createmeta_issuetypes() and createmeta_fieldtypes() client member functions to replace the deprecated form of the createmeta Jira endpoint. However, these functions return the raw JSON of a single response, and do not handle pagination that may be applied to the endpoints, such as when an issue type within a project has more than 50 associated fields. I recently encountered a Jira deployment where this case occurred, rendering createmeta_fieldtypes() unuseful. Because the functions added in 3.5.0 have a different return type than these new functions, instead of changing the behavior of those functions this commit creates two new client member functions: project_issue_types() and project_issue_fields(). * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add Field test case * Enable 'hard' delete in Cloud test framework * Replace previous implementation and tests * typo --------- Co-authored-by: Dominic Delabruere <ddelabru@redhat.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
686de78
commit cce214e
Showing
6 changed files
with
139 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from __future__ import annotations | ||
|
||
from jira.resources import Field | ||
from tests.conftest import JiraTestCase | ||
|
||
|
||
class FieldsTest(JiraTestCase): | ||
def setUp(self) -> None: | ||
super().setUp() | ||
self.issue_1 = self.test_manager.project_b_issue1 | ||
self.issue_1_obj = self.test_manager.project_b_issue1_obj | ||
|
||
def test_field(self): | ||
issue_fields = self.test_manager.jira_admin.project_issue_fields( | ||
project=self.project_a, issue_type=self.issue_1_obj.fields.issuetype.id | ||
) | ||
assert isinstance(issue_fields[0], Field) | ||
|
||
def test_field_pagination(self): | ||
issue_fields = self.test_manager.jira_admin.project_issue_fields( | ||
project=self.project_a, | ||
issue_type=self.issue_1_obj.fields.issuetype.id, | ||
startAt=50, | ||
) | ||
assert len(issue_fields) == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from __future__ import annotations | ||
|
||
from jira.resources import IssueType | ||
from tests.conftest import JiraTestCase | ||
|
||
|
||
class IssueTypeTest(JiraTestCase): | ||
def setUp(self) -> None: | ||
super().setUp() | ||
|
||
def test_issue_type(self): | ||
issue_types = self.test_manager.jira_admin.project_issue_types( | ||
project=self.project_a | ||
) | ||
assert isinstance(issue_types[0], IssueType) | ||
|
||
def test_issue_type_pagination(self): | ||
issue_types = self.test_manager.jira_admin.project_issue_types( | ||
project=self.project_a, startAt=50 | ||
) | ||
assert len(issue_types) == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters