Skip to content

Commit

Permalink
merge: Merge pull request #23 from DSD-DBS/fix-checksum-init-workitem
Browse files Browse the repository at this point in the history
fix: Set checksum from additional attributes
  • Loading branch information
micha91 authored Jan 17, 2024
2 parents 01e3043 + 508720d commit 822cddb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions polarion_rest_api_client/data_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def __init__(
self.description_type = description_type
self.description = description
self.additional_attributes = (additional_attributes or {}) | kwargs
self._checksum = self.additional_attributes.pop("checksum", None)
self.linked_work_items = linked_work_items or []
self.attachments = attachments or []

Expand Down
3 changes: 2 additions & 1 deletion tests/data/mock_api_responses/workitems_no_next_page.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"title": "Title",
"type": "task",
"updated": "1970-01-01T00:00:00Z",
"capella_uuid": "asdfgh"
"capella_uuid": "asdfgh",
"checksum": "123"
},
"relationships": {
"assignee": {
Expand Down
4 changes: 3 additions & 1 deletion tests/test_client_workitems.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_get_all_work_items_single_page(
"My text value",
"task",
"open",
{"capella_uuid": "asdfgh"},
{"capella_uuid": "asdfgh", "checksum": "123"},
[
polarion_api.WorkItemLink(
"MyWorkItemId2",
Expand All @@ -101,6 +101,8 @@ def test_get_all_work_items_single_page(
],
[polarion_api.WorkItemAttachment("MyWorkItemId2", "MyAttachmentId")],
)
assert "checksum" not in work_items[0].additional_attributes
assert work_items[0].get_current_checksum() == "123"


def test_get_all_work_items_faulty_item(
Expand Down

0 comments on commit 822cddb

Please sign in to comment.