From f60872b86c7c5c03a1c802a550ea4411e854d6c8 Mon Sep 17 00:00:00 2001 From: Daniel Mursa Date: Tue, 17 Dec 2024 10:46:02 +0100 Subject: [PATCH] [#486] Update tests --- src/objects/setup_configuration/steps/token_auth.py | 4 ++-- .../tests/test_token_auth_config.py | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/objects/setup_configuration/steps/token_auth.py b/src/objects/setup_configuration/steps/token_auth.py index a8e6b8a7..4137a362 100644 --- a/src/objects/setup_configuration/steps/token_auth.py +++ b/src/objects/setup_configuration/steps/token_auth.py @@ -99,12 +99,12 @@ def execute(self, model: TokenAuthGroupConfigurationModel) -> None: if key != "identifier" }, ) + self._configure_permissions(token, item.permissions) except IntegrityError as exception: - raise ConfigurationRunFailed( - "Failed configuring token %s" % token.identifier + "Failed configuring token %s" % item.identifier ) from exception logger.info("Configured %s", item.identifier) diff --git a/src/objects/setup_configuration/tests/test_token_auth_config.py b/src/objects/setup_configuration/tests/test_token_auth_config.py index a7c8676e..b55c9ea4 100644 --- a/src/objects/setup_configuration/tests/test_token_auth_config.py +++ b/src/objects/setup_configuration/tests/test_token_auth_config.py @@ -207,7 +207,8 @@ def test_invalid_setup_email(self): execute_single_step(TokenAuthConfigurationStep, object_source=object_source) self.assertTrue( - "Validation error(s) occured for token-1" in str(command_error.exception) + "Validation error(s) during instance cleaning" + in str(command_error.exception) ) self.assertEqual(TokenAuth.objects.count(), 0) @@ -232,7 +233,8 @@ def test_invalid_setup_token(self): execute_single_step(TokenAuthConfigurationStep, object_source=object_source) self.assertTrue( - "Validation error(s) occured for token-1" in str(command_error.exception) + "Validation error(s) during instance cleaning" + in str(command_error.exception) ) self.assertEqual(TokenAuth.objects.count(), 0) @@ -255,9 +257,9 @@ def test_invalid_empty_token(self): } with self.assertRaises(ConfigurationRunFailed) as command_error: execute_single_step(TokenAuthConfigurationStep, object_source=object_source) - self.assertTrue( - "Validation error(s) occured for token-1" in str(command_error.exception) + "Validation error(s) during instance cleaning" + in str(command_error.exception) ) self.assertEqual(TokenAuth.objects.count(), 0) @@ -338,7 +340,8 @@ def test_invalid_setup_contact_person(self): execute_single_step(TokenAuthConfigurationStep, object_source=object_source) self.assertTrue( - "Validation error(s) occured for token-1" in str(command_error.exception) + "Validation error(s) during instance cleaning" + in str(command_error.exception) ) self.assertEqual(TokenAuth.objects.count(), 0)