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

[CV Eval] add test for customer case bz #15268

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
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

from robottelo.constants import REPOS

Expand Down Expand Up @@ -108,3 +112,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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""Verify that you can't republish metadata from the UI, and you can from the CLI
"""Verify that republish metadata from the UI doesn't work and from the CLI it does work with --force true/yes/1 option

: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
Comment on lines +126 to +128
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
5. Verify that the "republish metadata" option from the UI doesn't work
6. Verify that the "republish metadata" from the CLI without the force option doesn't work
7. Verify that the "republish metadata" from the CLI using the --force = true/yes/1 does work

:expectedresults: You can't republish RH Repo metadata from the UI, and can from the CLI with --force
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:expectedresults: You can't republish RH Repo metadata from the UI, and can from the CLI with --force
:expectedresults: "republish RH Repo metadata" from UI not worked and it worked from the CLI with --force true/yes/1 option

: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"])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cv = target_sat.api.ContentView(id=cv.id, repository=[rh_repo]).update(["repository"])
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(
sambible marked this conversation as resolved.
Show resolved Hide resolved
cv.name, 'Version 1.0', "Republish repository metadata"
sambible marked this conversation as resolved.
Show resolved Hide resolved
)
assert (
'Item "Republish repository metadata" of dropdown ".//div[@data-ouia-component-id="cv-version-header-actions-dropdown"]" is disabled'
sambible marked this conversation as resolved.
Show resolved Hide resolved
in error.value.args[0]
)
with pytest.raises(CLIReturnCodeError) as error:
target_sat.cli.ContentView.version_republish_repositories(
{'id': version.id, 'force': 'false'}
)
Comment on lines +150 to +152
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
target_sat.cli.ContentView.version_republish_repositories(
{'id': version.id, 'force': 'false'}
)
target_sat.cli.ContentView.version_republish_repositories(
{'id': version.id}
)

Passing 'force': 'false' is optional I guess, could you please check it locally and update here

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'}
)
Loading