From 7356b568cd45d7ba406481908fe49afadff04f77 Mon Sep 17 00:00:00 2001 From: Daniel Vincze Date: Thu, 8 Aug 2024 17:07:44 +0300 Subject: [PATCH] Fix existing unit tests --- coriolisclient/cli/deployments.py | 3 ++- coriolisclient/tests/cli/test_replicas.py | 6 ++++++ coriolisclient/v1/deployments.py | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/coriolisclient/cli/deployments.py b/coriolisclient/cli/deployments.py index 0ef00f1..ac33550 100644 --- a/coriolisclient/cli/deployments.py +++ b/coriolisclient/cli/deployments.py @@ -254,7 +254,8 @@ def get_parser(self, prog_name): return parser def take_action(self, args): - self.app.client_manager.coriolis.deployments.cancel(args.id, args.force) + self.app.client_manager.coriolis.deployments.cancel( + args.id, args.force) class DeleteDeployment(command.Command): diff --git a/coriolisclient/tests/cli/test_replicas.py b/coriolisclient/tests/cli/test_replicas.py index 834da82..293d982 100644 --- a/coriolisclient/tests/cli/test_replicas.py +++ b/coriolisclient/tests/cli/test_replicas.py @@ -80,6 +80,7 @@ def test_get_formatted_data(self): obj.last_execution_status = mock.sentinel.last_execution_status obj.instances = ["mock_instance3", "mock_instance1", "mock_instance2"] obj.notes = mock.sentinel.notes + obj.scenario = mock.sentinel.scenario obj.created_at = mock.sentinel.created_at result = self.replica._get_formatted_data(obj) @@ -87,6 +88,7 @@ def test_get_formatted_data(self): self.assertEqual( ( mock.sentinel.id, + mock.sentinel.scenario, ('mock_instance3%(ls)smock_instance1%(ls)smock_instance2' % {"ls": "\n"}), mock.sentinel.notes, @@ -211,10 +213,12 @@ def test_get_formatted_data( mock_format_executions.return_value = \ mock.sentinel.formatted_executions mock_obj.info = mock.sentinel.info + mock_obj.scenario = mock.sentinel.scenario expected_result = [ mock.sentinel.id, mock.sentinel.created_at, mock.sentinel.updated_at, + mock.sentinel.scenario, mock.sentinel.reservation_id, mock.sentinel.formatted_instances, mock.sentinel.notes, @@ -281,6 +285,7 @@ def test_take_action( args = mock.Mock() args.instances = mock.sentinel.instances args.notes = mock.sentinel.notes + args.scenario = mock.sentinel.scenario args.origin_minion_pool_id = mock.sentinel.origin_minion_pool_id args.destination_minion_pool_id = \ mock.sentinel.destination_minion_pool_id @@ -315,6 +320,7 @@ def test_take_action( mock.sentinel.source_environment, mock.sentinel.destination_environment, mock.sentinel.instances, + mock.sentinel.scenario, network_map=mock.sentinel.network_map, notes=mock.sentinel.notes, storage_mappings=(mock_get_storage_mappings_dict_from_args. diff --git a/coriolisclient/v1/deployments.py b/coriolisclient/v1/deployments.py index 99990b2..8887921 100644 --- a/coriolisclient/v1/deployments.py +++ b/coriolisclient/v1/deployments.py @@ -59,7 +59,8 @@ def list(self, detail=False): return self._list(path, 'deployments') def get(self, deployment): - return self._get('/deployments/%s' % base.getid(deployment), 'deployment') + return self._get( + '/deployments/%s' % base.getid(deployment), 'deployment') def create_from_replica(self, replica_id, clone_disks=True, force=False, skip_os_morphing=False, user_scripts=None,