-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from moneymeets/feature/add-issue-work-items
feat(sdk): add issue work items
- Loading branch information
Showing
5 changed files
with
210 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
[ | ||
{ | ||
"duration": { | ||
"id": "100", | ||
"minutes": 100, | ||
"presentation": "1h 40m", | ||
"$type": "DurationValue" | ||
}, | ||
"date": 1709424000000, | ||
"created": 1710330927000, | ||
"updated": null, | ||
"type": { | ||
"name": "Development", | ||
"id": "1-0", | ||
"$type": "WorkItemType" | ||
}, | ||
"text": "Working hard", | ||
"creator": { | ||
"login": "mary.jane", | ||
"ringId": "26677773-c425-4f47-b62c-dbfb2ad21e8f", | ||
"email": "[email protected]", | ||
"name": "Mary Jane", | ||
"id": "1-52", | ||
"$type": "User" | ||
}, | ||
"author": { | ||
"login": "paul.lawson", | ||
"ringId": "d53ece48-4c60-4b88-b93f-68392b975087", | ||
"email": "", | ||
"name": "Paul Lawson", | ||
"id": "1-64", | ||
"$type": "User" | ||
}, | ||
"textPreview": "<div class=\"wiki text common-markdown\"><p>Working hard</p>\n</div>", | ||
"id": "12-14", | ||
"$type": "IssueWorkItem" | ||
} | ||
] |
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,17 @@ | ||
[ | ||
{ | ||
"name": "Development", | ||
"id": "1-0", | ||
"$type": "WorkItemType" | ||
}, | ||
{ | ||
"name": "Testing", | ||
"id": "1-1", | ||
"$type": "WorkItemType" | ||
}, | ||
{ | ||
"name": "Documentation", | ||
"id": "1-2", | ||
"$type": "WorkItemType" | ||
} | ||
] |
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 |
---|---|---|
|
@@ -13,16 +13,19 @@ | |
from youtrack_sdk.entities import ( | ||
Agile, | ||
AgileRef, | ||
DurationValue, | ||
Issue, | ||
IssueAttachment, | ||
IssueComment, | ||
IssueLink, | ||
IssueLinkType, | ||
IssueWorkItem, | ||
Project, | ||
Sprint, | ||
SprintRef, | ||
Tag, | ||
User, | ||
WorkItemType, | ||
) | ||
|
||
from .test_definitions import ( | ||
|
@@ -168,6 +171,50 @@ def test_get_issue_comments(self): | |
self.client.get_issue_comments(issue_id="1"), | ||
) | ||
|
||
@mock_response(url="https://server/api/issues/1/timeTracking/workItems", response_name="issue_work_items") | ||
def test_get_issue_work_items(self): | ||
self.assertEqual( | ||
( | ||
IssueWorkItem.model_construct( | ||
type="IssueWorkItem", | ||
id="12-14", | ||
author=User.model_construct( | ||
type="User", | ||
id="1-64", | ||
name="Paul Lawson", | ||
ring_id="d53ece48-4c60-4b88-b93f-68392b975087", | ||
login="paul.lawson", | ||
email="", | ||
), | ||
creator=User.model_construct( | ||
type="User", | ||
id="1-52", | ||
name="Mary Jane", | ||
ring_id="26677773-c425-4f47-b62c-dbfb2ad21e8f", | ||
login="mary.jane", | ||
email="[email protected]", | ||
), | ||
text="Working hard", | ||
text_preview='<div class="wiki text common-markdown"><p>Working hard</p>\n</div>', | ||
work_item_type=WorkItemType( | ||
type="WorkItemType", | ||
id="1-0", | ||
name="Development", | ||
), | ||
created=datetime(2024, 3, 13, 11, 55, 27, tzinfo=UTC), | ||
updated=None, | ||
duration=DurationValue( | ||
type="DurationValue", | ||
id="100", | ||
minutes=100, | ||
presentation="1h 40m", | ||
), | ||
date=datetime(2024, 3, 3, 0, 0, tzinfo=UTC), | ||
), | ||
), | ||
self.client.get_issue_work_items(issue_id="1"), | ||
) | ||
|
||
@mock_response(url="https://server/api/admin/projects", response_name="projects") | ||
def test_get_projects(self): | ||
self.assertEqual( | ||
|
@@ -188,6 +235,32 @@ def test_get_projects(self): | |
self.client.get_projects(), | ||
) | ||
|
||
@mock_response( | ||
url="https://server/api/admin/projects/DEMO/timeTrackingSettings/workItemTypes", | ||
response_name="work_item_types", | ||
) | ||
def test_get_project_work_item_types(self): | ||
self.assertEqual( | ||
( | ||
WorkItemType.model_construct( | ||
type="WorkItemType", | ||
id="1-0", | ||
name="Development", | ||
), | ||
WorkItemType.model_construct( | ||
type="WorkItemType", | ||
id="1-1", | ||
name="Testing", | ||
), | ||
WorkItemType.model_construct( | ||
type="WorkItemType", | ||
id="1-2", | ||
name="Documentation", | ||
), | ||
), | ||
self.client.get_project_work_item_types(project_id="DEMO"), | ||
) | ||
|
||
@mock_response(url="https://server/api/tags", response_name="tags") | ||
def test_get_tags(self): | ||
self.assertEqual( | ||
|
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