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 2, 2024
1 parent 8bd8221 commit 4c11a74
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 48 deletions.
74 changes: 73 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,70 @@ 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 published content view with 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
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 exist, is not in an environment.
: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}.'
)
# read UI info from CVV
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 (
lce_values['content_views']['resources'][0]['Name'] == cv['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']"""
# the environment(s) were found in the CV, after deleting the only CVV
session.contentview.delete(cv['name'])
lce_values = session.lifecycleenvironment.read(lce['name'])
assert cv not in lce_values['content_views']['resources']
70 changes: 23 additions & 47 deletions tests/foreman/ui/test_contentview_old.py
Original file line number Diff line number Diff line change
Expand Up @@ -1219,6 +1219,7 @@ def test_positive_promote_composite_with_custom_content(
assert f'Promoted to {lce.name}' in result['Status']


@pytest.mark.skip_if_open('BZ:2086957')
@pytest.mark.run_in_one_thread
@pytest.mark.tier2
def test_positive_publish_rh_content_with_errata_by_date_filter(
Expand Down Expand Up @@ -1342,6 +1343,7 @@ def test_positive_remove_cv_version_from_default_env(
assert ENVIRONMENT not in cvv['Environments']


@pytest.mark.skip_if_open('BZ:2086957')
@pytest.mark.tier2
@pytest.mark.skipif((not settings.robottelo.REPOS_HOSTING_URL), reason='Missing repos_hosting_url')
def test_positive_remove_promoted_cv_version_from_default_env(
Expand Down Expand Up @@ -1389,6 +1391,7 @@ def test_positive_remove_promoted_cv_version_from_default_env(
assert cvv['yum_repositories']['table'][0]['Name']


@pytest.mark.skip_if_open('BZ:2086957')
@pytest.mark.tier2
def test_positive_remove_qe_promoted_cv_version_from_default_env(
session, module_target_sat, module_org, target_sat
Expand Down Expand Up @@ -1445,6 +1448,7 @@ def test_positive_remove_qe_promoted_cv_version_from_default_env(
assert all(item in cvv_table[0]['Environments'] for item in [dev_lce.name, qe_lce.name])


@pytest.mark.skip_if_open('BZ:2086957')
@pytest.mark.tier2
@pytest.mark.skipif((not settings.robottelo.REPOS_HOSTING_URL), reason='Missing repos_hosting_url')
@pytest.mark.parametrize(
Expand Down Expand Up @@ -1518,53 +1522,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:
0. *docstring changes, to run PRT with identical branch*
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 Expand Up @@ -1815,6 +1772,7 @@ def test_positive_add_package_filter(session, module_target_sat, module_org, tar
assert expected_packages == actual_packages


@pytest.mark.skip_if_open('BZ:2086957')
@pytest.mark.tier3
def test_positive_add_package_inclusion_filter_and_publish(
session, module_target_sat, module_org, target_sat
Expand Down Expand Up @@ -1862,6 +1820,7 @@ def test_positive_add_package_inclusion_filter_and_publish(
assert not packages[0]['Name']


@pytest.mark.skip_if_open('BZ:2086957')
@pytest.mark.tier3
def test_positive_add_package_exclusion_filter_and_publish(
session, module_target_sat, module_org, target_sat
Expand Down Expand Up @@ -1909,6 +1868,7 @@ def test_positive_add_package_exclusion_filter_and_publish(
assert not packages[0]['Name']


@pytest.mark.skip_if_open('BZ:2086957')
@pytest.mark.tier3
@pytest.mark.skipif((not settings.robottelo.REPOS_HOSTING_URL), reason='Missing repos_hosting_url')
def test_positive_remove_package_from_exclusion_filter(
Expand Down Expand Up @@ -1958,6 +1918,7 @@ def test_positive_remove_package_from_exclusion_filter(
assert packages[0]['Name'] == package_name


@pytest.mark.skip_if_open('BZ:2086957')
@pytest.mark.tier3
def test_positive_update_inclusive_filter_package_version(
session, module_target_sat, module_org, target_sat
Expand Down Expand Up @@ -2023,6 +1984,7 @@ def test_positive_update_inclusive_filter_package_version(
assert packages[0]['Version'] == '5.21'


@pytest.mark.skip_if_open('BZ:2086957')
@pytest.mark.tier3
def test_positive_update_exclusive_filter_package_version(
session, module_target_sat, module_org, target_sat
Expand Down Expand Up @@ -2088,6 +2050,7 @@ def test_positive_update_exclusive_filter_package_version(
assert packages[0]['Version'] == '0.71'


@pytest.mark.skip_if_open('BZ:2086957')
@pytest.mark.tier3
@pytest.mark.skipif((not settings.robottelo.REPOS_HOSTING_URL), reason='Missing repos_hosting_url')
def test_positive_add_all_security_errata_by_date_range_filter(
Expand Down Expand Up @@ -2248,6 +2211,7 @@ def test_positive_promote_with_rh_custom_spin(session, module_target_sat, target
assert f'Promoted to {lce.name}' in result['Status']


@pytest.mark.skip_if_open('BZ:2086957')
@pytest.mark.tier3
@pytest.mark.skipif((not settings.robottelo.REPOS_HOSTING_URL), reason='Missing repos_hosting_url')
def test_positive_add_all_security_errata_by_id_filter(session, module_target_sat, module_org):
Expand Down Expand Up @@ -2295,6 +2259,7 @@ def test_positive_add_all_security_errata_by_id_filter(session, module_target_sa
)


@pytest.mark.skip_if_open('BZ:2086957')
@pytest.mark.tier3
def test_positive_add_errata_filter(session, module_target_sat, module_org, target_sat):
"""add errata to content views filter
Expand Down Expand Up @@ -2332,6 +2297,7 @@ def test_positive_add_errata_filter(session, module_target_sat, module_org, targ
}


@pytest.mark.skip_if_open('BZ:2086957')
@pytest.mark.tier3
@pytest.mark.skipif((not settings.robottelo.REPOS_HOSTING_URL), reason='Missing repos_hosting_url')
def test_positive_add_module_stream_filter(session, module_target_sat, module_org, target_sat):
Expand Down Expand Up @@ -2407,6 +2373,7 @@ def test_positive_add_package_group_filter(session, module_target_sat, module_or
assert cvf['content_tabs']['assigned'][0]['Name'] == package_group


@pytest.mark.skip_if_open('BZ:2086957')
@pytest.mark.tier3
@pytest.mark.skipif((not settings.robottelo.REPOS_HOSTING_URL), reason='Missing repos_hosting_url')
def test_positive_update_filter_affected_repos(session, module_target_sat, module_org, target_sat):
Expand Down Expand Up @@ -2713,6 +2680,7 @@ def test_positive_rh_mixed_content_end_to_end(
assert session.contentview.search_version(cv_name, VERSION)[0]['Version'] != VERSION


@pytest.mark.skip_if_open('BZ:2086957')
@pytest.mark.tier3
@pytest.mark.skipif((not settings.robottelo.REPOS_HOSTING_URL), reason='Missing repos_hosting_url')
def test_positive_errata_inc_update_list_package(session, module_target_sat, target_sat):
Expand Down Expand Up @@ -2772,6 +2740,7 @@ def test_positive_errata_inc_update_list_package(session, module_target_sat, tar
assert set(result[4:]).issubset(packages)


@pytest.mark.skip_if_open('BZ:2086957')
@pytest.mark.tier3
@pytest.mark.skipif((not settings.robottelo.REPOS_HOSTING_URL), reason='Missing repos_hosting_url')
def test_positive_composite_child_inc_update(
Expand Down Expand Up @@ -2938,6 +2907,7 @@ def test_positive_module_stream_end_to_end(session, module_target_sat, module_or
assert session.contentview.search(cv_name)[0]['Name'] != cv_name


@pytest.mark.skip_if_open('BZ:2086957')
@pytest.mark.tier3
@pytest.mark.skipif((not settings.robottelo.REPOS_HOSTING_URL), reason='Missing repos_hosting_url')
def test_positive_search_module_streams_in_content_view(
Expand Down Expand Up @@ -3298,6 +3268,7 @@ def test_negative_non_readonly_user_actions(module_org, test_name, target_sat):
assert 'Navigation failed to reach [All]' in str(context.value)


@pytest.mark.skip_if_open('BZ:2086957')
@pytest.mark.tier2
@pytest.mark.skipif((not settings.robottelo.REPOS_HOSTING_URL), reason='Missing repos_hosting_url')
def test_positive_conservative_solve_dependencies(
Expand Down Expand Up @@ -3377,6 +3348,7 @@ def test_positive_conservative_solve_dependencies(
assert not package[0]['Name']


@pytest.mark.skip_if_open('BZ:2086957')
@pytest.mark.tier2
def test_positive_conservative_dep_solving_with_multiversion_packages(
session, module_org, target_sat
Expand Down Expand Up @@ -3447,6 +3419,7 @@ def test_positive_conservative_dep_solving_with_multiversion_packages(
assert package[0]['Version'] == '0.71'


@pytest.mark.skip_if_open('BZ:2086957')
@pytest.mark.tier2
@pytest.mark.skipif((not settings.robottelo.REPOS_HOSTING_URL), reason='Missing repos_hosting_url')
def test_positive_depsolve_with_module_errata(session, module_target_sat, module_org, target_sat):
Expand Down Expand Up @@ -3524,6 +3497,7 @@ def test_positive_depsolve_with_module_errata(session, module_target_sat, module
assert result['errata']['table'][0]['Errata ID'] == settings.repos.yum_10.errata[0]


@pytest.mark.skip_if_open('BZ:2086957')
@pytest.mark.tier2
def test_positive_filter_by_pkg_group_name(session, module_target_sat, module_org, target_sat):
"""Publish a filtered version of a Content View, filtering on the package group's name.
Expand Down Expand Up @@ -3564,6 +3538,7 @@ def test_positive_filter_by_pkg_group_name(session, module_target_sat, module_or
assert expected_packages == [pkg['Name'] for pkg in result['rpm_packages']['table']]


@pytest.mark.skip_if_open('BZ:2086957')
@pytest.mark.tier3
def test_positive_inc_update_should_not_fail(session, module_target_sat, module_org):
"""Incremental update after removing a package should not give a 400 error code
Expand Down Expand Up @@ -3621,6 +3596,7 @@ def test_positive_inc_update_should_not_fail(session, module_target_sat, module_
assert packages[0]['Name'] == package1_name


@pytest.mark.skip_if_open('BZ:2086957')
@pytest.mark.tier2
def test_positive_no_duplicate_key_violate_unique_constraint_using_filters(
session, module_entitlement_manifest_org, target_sat
Expand Down

0 comments on commit 4c11a74

Please sign in to comment.