Skip to content

Commit

Permalink
CV_old upgrade case brought into new UI
Browse files Browse the repository at this point in the history
  • Loading branch information
damoore044 committed Oct 9, 2024
1 parent b56eacd commit 825362d
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 47 deletions.
75 changes: 74 additions & 1 deletion tests/foreman/ui/test_contentview.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
from fauxfactory import gen_string
import pytest

from robottelo.constants import FAKE_FILE_NEW_NAME, REPOS, DataFile
from robottelo.config import settings
from robottelo.constants import (
FAKE_FILE_NEW_NAME,
REPOS,
DataFile,
)


@pytest.mark.tier2
Expand Down Expand Up @@ -147,3 +152,71 @@ def test_file_cv_display(session, target_sat, module_org, module_product):
file_values = session.file.read_cv_table(FAKE_FILE_NEW_NAME)
assert len(file_values) == 1
assert file_values[0]['Name'] == cv.name


# @pytest.mark.upgrade
@pytest.mark.tier2
def test_positive_delete_cv_promoted_to_multi_env(
session,
module_target_sat,
module_org,
target_sat,
):
"""Delete the published content view and the version promoted to multiple
environments.
:id: f16f2db5-7f5b-4ebb-863e-6c18ff745ce4
:steps:
1. Create a yum repo on satellite
2. Create a content view and add the repository
3. Publish the content view, creates "Version 1.0"
4. Promote the "Version 1.0" to multiple environments Library -> DEV
5. Delete the promoted content view version
6. Publish and promote a new "Version 1.0" to multiple environments
7. Delete the content view
:expectedresults:
5. Deleting the promoted CVV, removed the CV from multiple environments.
7. Deleting the CV with promoted CVV, removed the CV from multiple environments.
:CaseImportance: High
"""
VERSION = 'Version 1.0'
repo = target_sat.cli_factory.RepositoryCollection(
repositories=[target_sat.cli_factory.YumRepository(url=settings.repos.yum_0.url)]
)
repo.setup(module_org.id)
cv, lce = repo.setup_content_view(module_org.id)
repo_name = repo.repos_info[0]['name']

with target_sat.ui_session() as session:
# session.location.select(loc_name=DEFAULT_LOC)
session.organization.select(org_name=module_org.name)
cv_info = session.contentview_new.search(cv['name'])[0]
assert cv_info['Latest version'] == VERSION, (
f'Latest version for CV {cv["name"]}: {cv_info["Latest version"]},'
f' does not match expected: {VERSION}.'
)
cvv_values = session.contentview_new.read_cv(cv['name'], VERSION)
assert lce['name'] in cvv_values['Environments']
# read UI info from repo table in CVV
repo_info = session.contentview_new.read_version_table(cv['name'], VERSION, 'repositories')
assert (
repo_name == repo_info[0]['Name']
), 'Repositories tab for CVV shows incorrect repo name.'
# read UI info from LCE of the CVV
lce_values = session.lifecycleenvironment.read(lce['name'])
assert len(lce_values['content_views']['resources']) == 1
assert (
cv['name'] == lce_values['content_views']['resources'][0]['Name']
), f'Environment {lce["name"]}, does not show expected CVV {cv["name"]}, contained within.'
# delete the CVV, try searching for it, then delete the ContentView itself
session.contentview_new.click_version_dropdown(cv['name'], VERSION, 'Delete')
# session.contentview.remove_version(cv['name'], VERSION, False, [ENVIRONMENT, lce['name']])
cv = session.contentview_new.search(cv['name'], VERSION)[0]
"""assert lce['name'] not in cv['Environments']
assert 'Library' not in cv['Environments']"""
session.contentview.delete(cv['name'])
lce_values = session.lifecycleenvironment.read(lce['name'])
assert cv not in lce_values['content_views']['resources']
46 changes: 0 additions & 46 deletions tests/foreman/ui/test_contentview_old.py
Original file line number Diff line number Diff line change
Expand Up @@ -1518,52 +1518,6 @@ def test_positive_remove_cv_version_from_env(
assert all(item in cvv['Environments'] for item in [ENVIRONMENT, dev_lce.name, qe_lce.name])


@pytest.mark.upgrade
@pytest.mark.tier2
@pytest.mark.skipif((not settings.robottelo.REPOS_HOSTING_URL), reason='Missing repos_hosting_url')
def test_positive_delete_cv_promoted_to_multi_env(
session, module_target_sat, module_org, target_sat
):
"""Delete published content view with version promoted to multiple
environments
:id: f16f2db5-7f5b-4ebb-863e-6c18ff745ce4
:steps:
1. Create a content view
2. Add a yum repo to the content view
3. Publish the content view
4. Promote the content view to multiple environment Library -> DEV
5. Disassociate content view from promoted environment
6. Delete the content view.
:expectedresults: The content view doesn't exists.
:CaseImportance:High
"""
repo = target_sat.cli_factory.RepositoryCollection(
repositories=[target_sat.cli_factory.YumRepository(url=settings.repos.yum_0.url)]
)
repo.setup(module_org.id)
cv, lce = repo.setup_content_view(module_org.id)
repo_name = repo.repos_info[0]['name']
with session:
cvv = session.contentview.read_version(cv['name'], VERSION)
assert repo_name == cvv['yum_repositories']['table'][0]['Name']
cvv = session.contentview.search_version(cv['name'], VERSION)[0]
assert lce['name'] in cvv['Environments']
lce_values = session.lifecycleenvironment.read(lce['name'])
assert len(lce_values['content_views']['resources']) == 1
assert lce_values['content_views']['resources'][0]['Name'] == cv['name']
session.contentview.remove_version(cv['name'], VERSION, False, [ENVIRONMENT, lce['name']])
cvv = session.contentview.search_version(cv['name'], VERSION)[0]
assert lce['name'] not in cvv['Environments']
session.contentview.delete(cv['name'])
lce_values = session.lifecycleenvironment.read(lce['name'])
assert cv not in lce_values['content_views']['resources']


@pytest.mark.tier2
@pytest.mark.upgrade
def test_positive_delete_composite_version(session, module_target_sat, module_org, target_sat):
Expand Down

0 comments on commit 825362d

Please sign in to comment.