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 Composite CV #17530

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
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