Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AK for errata UI tests #16707

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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