diff options
| author | Oliver Blasius <blasius@futavis.de> | 2022-11-24 14:30:48 +0100 |
|---|---|---|
| committer | Nejc Habjan <hab.nejc@gmail.com> | 2022-12-04 11:20:03 +0100 |
| commit | ef5feb4d07951230452a2974da729a958bdb9d6a (patch) | |
| tree | 2063591dc98c1e21cbc9e9ff64aa049d91b22040 /tests/unit/objects | |
| parent | e88d34e38dd930b00d7bb48f0e1c39420e09fa0f (diff) | |
| download | gitlab-ef5feb4d07951230452a2974da729a958bdb9d6a.tar.gz | |
feat: add resource iteration events (see https://docs.gitlab.com/ee/api/resource_iteration_events.html)
Diffstat (limited to 'tests/unit/objects')
| -rw-r--r-- | tests/unit/objects/test_resource_iteration_events.py | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/unit/objects/test_resource_iteration_events.py b/tests/unit/objects/test_resource_iteration_events.py new file mode 100644 index 0000000..6b3b463 --- /dev/null +++ b/tests/unit/objects/test_resource_iteration_events.py @@ -0,0 +1,55 @@ +""" +GitLab API: https://docs.gitlab.com/ee/api/resource_iteration_events.html +""" + +import pytest +import responses + +from gitlab.v4.objects import ProjectIssueResourceIterationEvent + +issue_event_content = {"id": 1, "resource_type": "Issue"} + + +@pytest.fixture() +def resp_list_project_issue_iteration_events(): + with responses.RequestsMock() as rsps: + rsps.add( + method=responses.GET, + url="http://localhost/api/v4/projects/1/issues/1/resource_iteration_events", + json=[issue_event_content], + content_type="application/json", + status=200, + ) + yield rsps + + +@pytest.fixture() +def resp_get_project_issue_iteration_event(): + with responses.RequestsMock() as rsps: + rsps.add( + method=responses.GET, + url="http://localhost/api/v4/projects/1/issues/1/resource_iteration_events/1", + json=issue_event_content, + content_type="application/json", + status=200, + ) + yield rsps + + +def test_list_project_issue_iteration_events( + project_issue, resp_list_project_issue_iteration_events +): + iteration_events = project_issue.resource_iteration_events.list() + assert isinstance(iteration_events, list) + + iteration_event = iteration_events[0] + assert isinstance(iteration_event, ProjectIssueResourceIterationEvent) + assert iteration_event.resource_type == "Issue" + + +def test_get_project_issue_iteration_event( + project_issue, resp_get_project_issue_iteration_event +): + iteration_event = project_issue.resource_iteration_events.get(1) + assert isinstance(iteration_event, ProjectIssueResourceIterationEvent) + assert iteration_event.resource_type == "Issue" |
