Skip to content

Commit

Permalink
feat: support registering specifying environments with activation keys
Browse files Browse the repository at this point in the history
* Card-ID: CCT-762
* Removes validation to prevent specifying environment during
  registration with activation key
  • Loading branch information
rverdile authored and ptoscano committed Sep 30, 2024
1 parent c124784 commit f222b57
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 13 deletions.
4 changes: 0 additions & 4 deletions src/rhsmlib/services/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 0 additions & 9 deletions test/rhsmlib/services/test_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f222b57

Please sign in to comment.