Skip to content

Commit

Permalink
fix: Reuse existing deleted work items
Browse files Browse the repository at this point in the history
  • Loading branch information
micha91 committed Nov 21, 2024
1 parent aaaf532 commit 3c92328
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions capella2polarion/connectors/polarion_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ def compare_and_update_work_item(
assert old is not None
assert old.id is not None

if old.status == self.project_client.work_items.delete_status:
old.checksum = None

new.calculate_checksum()
if not self.force_update and new.checksum == old.checksum:
return
Expand Down
3 changes: 3 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ def _setup_polarion_worker(
monkeypatch.setattr(polarion_api, "ProjectClient", mock_project_client)
pw = polarion_worker.CapellaPolarionWorker(params)
pw.project_client.work_items.create.side_effect = _set_work_item_id
pw.project_client.work_items.delete_status = (
None if params.delete_work_items else "deleted"
)
return pw


Expand Down

0 comments on commit 3c92328

Please sign in to comment.