Skip to content

Commit

Permalink
Fix Composite CV
Browse files Browse the repository at this point in the history
  • Loading branch information
shweta83 committed Feb 7, 2025
1 parent e65f398 commit 230314c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
7 changes: 7 additions & 0 deletions pytest_fixtures/component/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ def repo_setup(target_sat):
product = target_sat.api.Product(organization=org).create()
repo = target_sat.api.Repository(name=repo_name, product=product).create()
lce = target_sat.api.LifecycleEnvironment(organization=org).create()
target_sat.wait_for_tasks(
search_query='Actions::Katello::Repository::MetadataGenerate'
f' and resource_id = {repo.id}'
' and resource_type = Katello::Repository',
max_tries=6,
search_rate=10,
)
return {'org': org, 'product': product, 'repo': repo, 'lce': lce}


Expand Down
22 changes: 13 additions & 9 deletions tests/foreman/ui/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def test_positive_update_restrict_composite_view(
composite_cv = module_target_sat.api.ContentView(
composite=True, organization=repo_setup['org']
).create()

content_view = add_content_views_to_composite(
composite_cv, repo_setup['org'], repo_setup['repo'], module_target_sat
)
Expand All @@ -74,22 +75,25 @@ def test_positive_update_restrict_composite_view(
for param_value in ['Yes', 'No']:
session.settings.update(f'name = {property_name}', param_value)
if param_value == 'Yes':
with pytest.raises(AssertionError) as context:
session.contentview.promote(
composite_cv.name, 'Version 1.0', repo_setup['lce'].name
)
err_message = f"['Danger alert: The action requested on this composite view cannot be performed until all of the component content view versions have been promoted to the target environment: [\"{composite_cv.name}\"]. This restriction is optional and can be modified in the Administrator -> Settings -> Content page using the restrict_composite_view flag.']"
result = session.contentview_new.promote(
composite_cv.name,
'version = 1',
repo_setup['lce'].name,
err_message=err_message,
)
assert (
'Administrator -> Settings -> Content page using the '
'restrict_composite_view flag.' in str(context.value)
'restrict_composite_view flag.' in result[0]
)
else:
result = session.contentview.promote(
composite_cv.name, 'Version 1.0', repo_setup['lce'].name
result = session.contentview_new.promote(
composite_cv.name, 'version = 1', repo_setup['lce'].name
)

assert repo_setup['lce'].name in result['Environments']
for content_view_name in [composite_cv.name, content_view.name]:
session.contentview.remove_version(content_view_name, 'Version 1.0')
session.contentview.delete(content_view_name)
session.contentview_new.delete(content_view_name)


@pytest.mark.tier2
Expand Down

0 comments on commit 230314c

Please sign in to comment.