Skip to content

Commit

Permalink
add test for customer case bz
Browse files Browse the repository at this point in the history
  • Loading branch information
sambible committed Jun 3, 2024
1 parent 9f38177 commit 7548d59
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions tests/foreman/ui/test_contentview.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

from fauxfactory import gen_string
import pytest
from widgetastic_patternfly4.dropdown import DropdownItemDisabled

from robottelo.constants import REPOS
from robottelo.exceptions import CLIReturnCodeError


@pytest.mark.tier2
Expand Down Expand Up @@ -65,3 +69,51 @@ def test_no_blank_page_on_language_switch(session, target_sat, module_org):
with target_sat.ui_session(user=user.login, password=user_password) as session:
session.user.update(user.login, {'user.language': 'Français'})
assert session.contentview_new.read_french_lang_cv()


def test_republish_metadata(session, function_sca_manifest_org, target_sat):
"""Verify that you can't republish metadata from the UI, and you can from the CLI
:id: 96ef4fe5-dec4-4919-aa4d-b8806d90b654
:steps:
1. Enable and Sync RH Repo
2. Add repo to a CV
3. Publish the CV
4. Navigate to the published Version's page
5. Verify that you can't click the "republish metadata" option from the UI
6. Verify that you can't republish metadata from the cli without the force option
7. Verify that you can republish metadata from the CLI using the --force option
:expectedresults: You can't republish RH Repo metadata from the UI, and can from the CLI with --force
:CaseImportance: Critical
:BZ: 2227271
:customerscenario: true
"""
rh_repo_id = target_sat.api_factory.enable_sync_redhat_repo(
REPOS['rhae2.9_el8'], function_sca_manifest_org.id
)
rh_repo = target_sat.api.Repository(id=rh_repo_id).read()
cv = target_sat.api.ContentView(organization=function_sca_manifest_org).create()
cv = target_sat.api.ContentView(id=cv.id, repository=[rh_repo]).update(["repository"])
cv.publish()
version = cv.read().version[0].read()
with target_sat.ui_session() as session:
session.organization.select(org_name=function_sca_manifest_org.name)
with pytest.raises(DropdownItemDisabled) as error:
session.contentview_new.click_version_dropdown(
cv.name, 'Version 1.0', "Republish repository metadata"
)
assert (
'Item "Republish repository metadata" of dropdown ".//div[@data-ouia-component-id="cv-version-header-actions-dropdown"]" is disabled'
in error.value.args[0]
)
with pytest.raises(CLIReturnCodeError) as error:
target_sat.cli.ContentView.version_republish_repositories(
{'id': version.id, 'force': 'false'}
)
assert (
'Could not republish the Content View:\n Metadata republishing is dangerous on content view versions with repositories with the \'Complete Mirroring\' mirroring policy.'
in error.value.stderr
)
# This returns '' when successful, so this is just run to test that it doesn't throw any errors.
target_sat.cli.ContentView.version_republish_repositories(
{'id': version.id, 'force': 'true'}
)

0 comments on commit 7548d59

Please sign in to comment.