From 921df06733d4d8e9bf47c216efb72ff2436228bc Mon Sep 17 00:00:00 2001 From: Samuel Bible Date: Fri, 21 Jun 2024 11:53:47 -0500 Subject: [PATCH] [CC Automation] Add test covering interaction between File screen and published Content Views (#15414) * Add test for customer case BZ * Update docstring Co-authored-by: vijay sawant * Fix whitespace issue --------- Co-authored-by: vijay sawant --- tests/foreman/ui/test_contentview.py | 41 +++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/tests/foreman/ui/test_contentview.py b/tests/foreman/ui/test_contentview.py index ee7b7f2ca27..dbfba961ed5 100644 --- a/tests/foreman/ui/test_contentview.py +++ b/tests/foreman/ui/test_contentview.py @@ -15,7 +15,7 @@ from fauxfactory import gen_string import pytest -from robottelo.constants import REPOS +from robottelo.constants import FAKE_FILE_NEW_NAME, REPOS, DataFile @pytest.mark.tier2 @@ -108,3 +108,42 @@ 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() + + +@pytest.mark.tier2 +def test_file_cv_display(session, target_sat, module_org, module_product): + """Content-> Files displays only the Content Views associated with that file + + :id: 41719f2f-2170-4b26-b65f-2063a1eac7fb + + :steps: + 1. Create a file repo, and upload content into it + 2. Add file repo to a CV, and publish it + 3. Create another CV, and publish it + 4. Navigate to the Content -> File section of the UI + + :expectedresults: Only the Content View with the file repo is displayed. + + :BZ: 2026701 + + :customerscenario: true + + :Verifies: SAT-17081 + """ + repo_name = gen_string('alpha') + file_repo = target_sat.api.Repository( + product=module_product, name=f'{repo_name}_file_repo', content_type='file' + ).create() + with open(DataFile.FAKE_FILE_NEW_NAME, 'rb') as handle: + file_repo.upload_content(files={'content': handle}) + assert file_repo.read().content_counts['file'] == 1 + cv = target_sat.api.ContentView(organization=module_org).create() + cv = target_sat.api.ContentView(id=cv.id, repository=[file_repo]).update(['repository']) + cv.publish() + cv2 = target_sat.api.ContentView(organization=module_org).create() + cv2.publish() + with target_sat.ui_session() as session: + session.organization.select(org_name=module_org.name) + file_values = session.file.read_cv_table(FAKE_FILE_NEW_NAME) + assert len(file_values) == 1 + assert file_values[0]['Name'] == cv.name