| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e88d34e commit ef5feb4
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -203,6 +203,10 @@ Get the list of participants:: | |||
| 203 | 203 | ||
| 204 | 204 | users = issue.participants() | |
| 205 | 205 | ||
| 206 | + Get the list of iteration events:: | ||
| 207 | + | ||
| 208 | + iteration_events = issue.resource_iteration_events.list() | ||
| 209 | + | ||
| 206 | 210 | Issue links | |
| 207 | 211 | =========== | |
| 208 | 212 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,6 +15,8 @@ | |||
| 15 | 15 | "ProjectIssueResourceMilestoneEvent", | |
| 16 | 16 | "ProjectIssueResourceMilestoneEventManager", | |
| 17 | 17 | "ProjectIssueResourceStateEvent", | |
| 18 | + "ProjectIssueResourceIterationEventManager", | ||
| 19 | + "ProjectIssueResourceIterationEvent", | ||
| 18 | 20 | "ProjectIssueResourceStateEventManager", | |
| 19 | 21 | "ProjectMergeRequestResourceLabelEvent", | |
| 20 | 22 | "ProjectMergeRequestResourceLabelEventManager", | |
@@ -116,6 +118,23 @@ def get( | |||
| 116 | 118 | ) | |
| 117 | 119 | ||
| 118 | 120 | ||
| 121 | + class ProjectIssueResourceIterationEvent(RESTObject): | ||
| 122 | + pass | ||
| 123 | + | ||
| 124 | + | ||
| 125 | + class ProjectIssueResourceIterationEventManager(RetrieveMixin, RESTManager): | ||
| 126 | + _path = "/projects/{project_id}/issues/{issue_iid}/resource_iteration_events" | ||
| 127 | + _obj_cls = ProjectIssueResourceIterationEvent | ||
| 128 | + _from_parent_attrs = {"project_id": "project_id", "issue_iid": "iid"} | ||
| 129 | + | ||
| 130 | + def get( | ||
| 131 | + self, id: Union[str, int], lazy: bool = False, **kwargs: Any | ||
| 132 | + ) -> ProjectIssueResourceIterationEvent: | ||
| 133 | + return cast( | ||
| 134 | + ProjectIssueResourceIterationEvent, super().get(id=id, lazy=lazy, **kwargs) | ||
| 135 | + ) | ||
| 136 | + | ||
| 137 | + | ||
| 119 | 138 | class ProjectMergeRequestResourceLabelEvent(RESTObject): | |
| 120 | 139 | pass | |
| 121 | 140 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,6 +23,7 @@ | |||
| 23 | 23 | from .award_emojis import ProjectIssueAwardEmojiManager # noqa: F401 | |
| 24 | 24 | from .discussions import ProjectIssueDiscussionManager # noqa: F401 | |
| 25 | 25 | from .events import ( # noqa: F401 | |
| 26 | + ProjectIssueResourceIterationEventManager, | ||
| 26 | 27 | ProjectIssueResourceLabelEventManager, | |
| 27 | 28 | ProjectIssueResourceMilestoneEventManager, | |
| 28 | 29 | ProjectIssueResourceStateEventManager, | |
@@ -119,6 +120,7 @@ class ProjectIssue( | |||
| 119 | 120 | resourcelabelevents: ProjectIssueResourceLabelEventManager | |
| 120 | 121 | resourcemilestoneevents: ProjectIssueResourceMilestoneEventManager | |
| 121 | 122 | resourcestateevents: ProjectIssueResourceStateEventManager | |
| 123 | + resource_iteration_events: ProjectIssueResourceIterationEventManager | ||
| 122 | 124 | ||
| 123 | 125 | @cli.register_custom_action("ProjectIssue", ("to_project_id",)) | |
| 124 | 126 | @exc.on_http_error(exc.GitlabUpdateError) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,55 @@ | |||
| 1 | + """ | ||
| 2 | + GitLab API: https://docs.gitlab.com/ee/api/resource_iteration_events.html | ||
| 3 | + """ | ||
| 4 | + | ||
| 5 | + import pytest | ||
| 6 | + import responses | ||
| 7 | + | ||
| 8 | + from gitlab.v4.objects import ProjectIssueResourceIterationEvent | ||
| 9 | + | ||
| 10 | + issue_event_content = {"id": 1, "resource_type": "Issue"} | ||
| 11 | + | ||
| 12 | + | ||
| 13 | + @pytest.fixture() | ||
| 14 | + def resp_list_project_issue_iteration_events(): | ||
| 15 | + with responses.RequestsMock() as rsps: | ||
| 16 | + rsps.add( | ||
| 17 | + method=responses.GET, | ||
| 18 | + url="http://localhost/api/v4/projects/1/issues/1/resource_iteration_events", | ||
| 19 | + json=[issue_event_content], | ||
| 20 | + content_type="application/json", | ||
| 21 | + status=200, | ||
| 22 | + ) | ||
| 23 | + yield rsps | ||
| 24 | + | ||
| 25 | + | ||
| 26 | + @pytest.fixture() | ||
| 27 | + def resp_get_project_issue_iteration_event(): | ||
| 28 | + with responses.RequestsMock() as rsps: | ||
| 29 | + rsps.add( | ||
| 30 | + method=responses.GET, | ||
| 31 | + url="http://localhost/api/v4/projects/1/issues/1/resource_iteration_events/1", | ||
| 32 | + json=issue_event_content, | ||
| 33 | + content_type="application/json", | ||
| 34 | + status=200, | ||
| 35 | + ) | ||
| 36 | + yield rsps | ||
| 37 | + | ||
| 38 | + | ||
| 39 | + def test_list_project_issue_iteration_events( | ||
| 40 | + project_issue, resp_list_project_issue_iteration_events | ||
| 41 | + ): | ||
| 42 | + iteration_events = project_issue.resource_iteration_events.list() | ||
| 43 | + assert isinstance(iteration_events, list) | ||
| 44 | + | ||
| 45 | + iteration_event = iteration_events[0] | ||
| 46 | + assert isinstance(iteration_event, ProjectIssueResourceIterationEvent) | ||
| 47 | + assert iteration_event.resource_type == "Issue" | ||
| 48 | + | ||
| 49 | + | ||
| 50 | + def test_get_project_issue_iteration_event( | ||
| 51 | + project_issue, resp_get_project_issue_iteration_event | ||
| 52 | + ): | ||
| 53 | + iteration_event = project_issue.resource_iteration_events.get(1) | ||
| 54 | + assert isinstance(iteration_event, ProjectIssueResourceIterationEvent) | ||
| 55 | + assert iteration_event.resource_type == "Issue" | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments