Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: delete work item logic #127

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: delete work item logic
micha91 committed Oct 25, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit b2f113d6c9a29bae0588a5473574dbbc9cb4c131
2 changes: 1 addition & 1 deletion capella2polarion/connectors/polarion_worker.py
Original file line number Diff line number Diff line change
@@ -85,7 +85,7 @@ def __init__(
self.project_client = self.polarion_client.generate_project_client(
project_id=self.polarion_params.project_id,
delete_status=(
"deleted" if self.polarion_params.delete_work_items else None
None if self.polarion_params.delete_work_items else "deleted"
),
)
self._additional_clients: dict[str, polarion_api.ProjectClient] = {}
36 changes: 36 additions & 0 deletions tests/test_worker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright DB InfraGO AG and contributors
# SPDX-License-Identifier: Apache-2.0

from unittest import mock

from capella2polarion.connectors import polarion_worker


def test_polarion_worker_non_delete_mode():
with mock.patch.object(
polarion_worker.CapellaPolarionWorker, "check_client"
):
worker = polarion_worker.CapellaPolarionWorker(
polarion_worker.PolarionWorkerParams(
project_id="TEST",
url="http://127.0.0.1",
pat="PrivateAccessToken",
delete_work_items=False,
)
)
assert worker.project_client.work_items.delete_status == "deleted"


def test_polarion_worker_delete_mode():
with mock.patch.object(
polarion_worker.CapellaPolarionWorker, "check_client"
):
worker = polarion_worker.CapellaPolarionWorker(
polarion_worker.PolarionWorkerParams(
project_id="TEST",
url="http://127.0.0.1",
pat="PrivateAccessToken",
delete_work_items=True,
)
)
assert worker.project_client.work_items.delete_status is None