From f222b573a59c6e0053302beaf7c722806fd87554 Mon Sep 17 00:00:00 2001 From: rverdile Date: Wed, 25 Sep 2024 13:55:00 -0400 Subject: [PATCH] feat: support registering specifying environments with activation keys * Card-ID: CCT-762 * Removes validation to prevent specifying environment during registration with activation key --- src/rhsmlib/services/register.py | 4 ---- test/rhsmlib/services/test_register.py | 9 --------- 2 files changed, 13 deletions(-) diff --git a/src/rhsmlib/services/register.py b/src/rhsmlib/services/register.py index 8f6f783603..0af7e3761a 100644 --- a/src/rhsmlib/services/register.py +++ b/src/rhsmlib/services/register.py @@ -239,10 +239,6 @@ def validate_options(self, options: dict) -> None: raise exceptions.ValidationError( _("Error: Activation keys can not be used with previously" " registered IDs.") ) - elif options["environments"]: - raise exceptions.ValidationError( - _("Error: Activation keys do not allow environments to be" " specified.") - ) elif options.get("jwt_token") is not None: # TODO: add more checks here pass diff --git a/test/rhsmlib/services/test_register.py b/test/rhsmlib/services/test_register.py index 0bf5b888c8..4eccc814dd 100644 --- a/test/rhsmlib/services/test_register.py +++ b/test/rhsmlib/services/test_register.py @@ -508,15 +508,6 @@ def test_does_not_allow_basic_auth_with_activation_keys(self): with self.assertRaisesRegex(exceptions.ValidationError, r".*do not require user credentials.*"): register.RegisterService(self.mock_cp).validate_options(options) - def test_does_not_allow_environment_with_activation_keys(self): - self.mock_cp.username = None - self.mock_cp.password = None - - self.mock_identity.is_valid.return_value = False - options = self._build_options(activation_keys=[1], environments="environment") - with self.assertRaisesRegex(exceptions.ValidationError, r".*do not allow environments.*"): - register.RegisterService(self.mock_cp).validate_options(options) - def test_does_not_allow_environment_with_consumerid(self): self.mock_cp.username = None self.mock_cp.password = None