Skip to content

Commit

Permalink
Fix AK for errata UI tests (SatelliteQE#16707)
Browse files Browse the repository at this point in the history
  • Loading branch information
vsedmik authored Oct 23, 2024
1 parent 0fe4b06 commit 9fbd054
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 1 addition & 2 deletions pytest_fixtures/component/activationkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ def function_activation_key(function_sca_manifest_org, target_sat):


@pytest.fixture(scope='module')
def module_ak(module_lce, module_org, module_target_sat):
def module_ak(module_org, module_target_sat):
return module_target_sat.api.ActivationKey(
environment=module_lce,
organization=module_org,
).create()

Expand Down
8 changes: 5 additions & 3 deletions robottelo/host_helpers/api_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,19 +608,21 @@ def register_host_and_needed_setup(
# updated entities after promoting
entities = {k: v.read() for k, v in entities.items()}

updates = []
if ( # assign env to ak if not present
entities['ActivationKey'].environment is None
or entities['ActivationKey'].environment.id != entities['LifecycleEnvironment'].id
):
entities['ActivationKey'].environment = entities['LifecycleEnvironment']
entities['ActivationKey'].update(['environment'])
entities = {k: v.read() for k, v in entities.items()}
updates.append('environment')
if ( # assign cv to ak if not present
entities['ActivationKey'].content_view is None
or entities['ActivationKey'].content_view.id != entities['ContentView'].id
):
entities['ActivationKey'].content_view = entities['ContentView']
entities['ActivationKey'].update(['content_view'])
updates.append('content_view')
if updates:
entities['ActivationKey'].update(['content_view', 'environment']) # both needed anyway

entities = {k: v.read() for k, v in entities.items()}
if enable_repos:
Expand Down

0 comments on commit 9fbd054

Please sign in to comment.