From 6e19b6b7deeba96ba39866b6e98bf4abb6bb7372 Mon Sep 17 00:00:00 2001 From: Michael Harbarth Date: Wed, 26 Jun 2024 17:05:55 +0200 Subject: [PATCH] refactor: rebase and minor changes --- capella2polarion/__main__.py | 3 --- capella2polarion/connectors/polarion_worker.py | 10 +--------- tests/conftest.py | 4 +--- tests/test_elements.py | 10 +--------- tests/test_workitem_attachments.py | 3 +-- 5 files changed, 4 insertions(+), 26 deletions(-) diff --git a/capella2polarion/__main__.py b/capella2polarion/__main__.py index 582344a..23f43d5 100644 --- a/capella2polarion/__main__.py +++ b/capella2polarion/__main__.py @@ -106,10 +106,7 @@ def synchronize(ctx: click.core.Context) -> None: polarion_worker = pw.CapellaPolarionWorker( capella_to_polarion_cli.polarion_params, - capella_to_polarion_cli.config, capella_to_polarion_cli.force_update, - type_prefix=capella_to_polarion_cli.type_prefix, - role_prefix=capella_to_polarion_cli.role_prefix, ) polarion_worker.load_polarion_work_item_map() diff --git a/capella2polarion/connectors/polarion_worker.py b/capella2polarion/connectors/polarion_worker.py index 59971fd..5feef10 100644 --- a/capella2polarion/connectors/polarion_worker.py +++ b/capella2polarion/connectors/polarion_worker.py @@ -43,19 +43,11 @@ class CapellaPolarionWorker: """CapellaPolarionWorker encapsulate the Polarion API Client work.""" def __init__( - self, - params: PolarionWorkerParams, - config: converter_config.ConverterConfig, - force_update: bool = False, - type_prefix: str = "", - role_prefix: str = "", + self, params: PolarionWorkerParams, force_update: bool = False ) -> None: self.polarion_params = params self.polarion_data_repo = polarion_repo.PolarionDataRepository() - self.config = config self.force_update = force_update - self.type_prefix = type_prefix - self.role_prefix = role_prefix if (self.polarion_params.project_id is None) or ( len(self.polarion_params.project_id) == 0 diff --git a/tests/conftest.py b/tests/conftest.py index 37496b7..502b2c3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -170,8 +170,6 @@ def write(self, text: str): ), } - pw = polarion_worker.CapellaPolarionWorker( - c2p_cli.polarion_params, c2p_cli.config - ) + pw = polarion_worker.CapellaPolarionWorker(c2p_cli.polarion_params) pw.polarion_data_repo = polarion_repo.PolarionDataRepository([work_item]) return BaseObjectContainer(c2p_cli, pw, mc) diff --git a/tests/test_elements.py b/tests/test_elements.py index 9a504f7..576a130 100644 --- a/tests/test_elements.py +++ b/tests/test_elements.py @@ -211,9 +211,7 @@ def write(self, text: str): ) } - pw = polarion_worker.CapellaPolarionWorker( - c2p_cli.polarion_params, c2p_cli.config - ) + pw = polarion_worker.CapellaPolarionWorker(c2p_cli.polarion_params) pw.polarion_data_repo = polarion_repo.PolarionDataRepository( [work_item] @@ -745,9 +743,6 @@ def test_update_work_items( "get_all_work_items", polarion_api_get_all_work_items, ) - config = mock.Mock(converter_config.ConverterConfig) - config.polarion_types = set() - base_object.pw.config = config base_object.pw.load_polarion_work_item_map() @@ -812,9 +807,6 @@ def test_update_deleted_work_item( "get_all_work_items", polarion_api_get_all_work_items, ) - config = mock.Mock(converter_config.ConverterConfig) - config.polarion_types = set() - base_object.pw.config = config base_object.pw.load_polarion_work_item_map() diff --git a/tests/test_workitem_attachments.py b/tests/test_workitem_attachments.py index 9eccbca..f41038f 100644 --- a/tests/test_workitem_attachments.py +++ b/tests/test_workitem_attachments.py @@ -66,8 +66,7 @@ def worker(monkeypatch: pytest.MonkeyPatch): "http://localhost", "TESTPAT", False, - ), - config, + ) )