Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
damoore044 committed May 22, 2024
1 parent 0a47be9 commit 7103280
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions tests/foreman/ui/test_errata.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def cv_publish_promote(sat, org, cv, lce=None, needs_publish=True):
:param lce: if None, default to 'Library',
pass a single instance of lce, or list of instances.
do not pass the Library environment
do not pass the Library environment.
:param bool needs_publish: if False, skip publish of a new version
:return dictionary:
'content-view': instance of updated cv
Expand Down Expand Up @@ -330,7 +330,7 @@ def test_end_to_end(
],
'module_stream_packages': [],
}
# client was registered with no repos
# client was registered with single custom repo
client = registered_contenthost
hostname = client.hostname
assert client.subscribed
Expand Down Expand Up @@ -369,7 +369,7 @@ def test_end_to_end(
environment=module_lce.name,
)
assert len(results) == 1
# BZ 2265095: Check all columns in table of applicable host:
# BZ 2265095: Check default columns in table of applicable host:
# from ContentTypes > Errata > Details > Content Hosts tab
assert results[0]['Name'] == hostname
# assert str(client.deploy_rhel_version) in results[0]['OS']
Expand Down Expand Up @@ -529,12 +529,12 @@ def test_host_content_errata_tab_pagination(
:BZ: 1662254, 1846670
"""
org = module_sca_manifest_org
all_repos = module_target_sat.api.Repository(organization=org).search()
# custom_repo was created & added to cv, in registered_contenthost fixture
# search for the instance
custom_repo = [repo for repo in all_repos if repo.url == CUSTOM_REPO_3_URL]
assert len(custom_repo) > 0
custom_repo = custom_repo[0].read()
# custom_repo was created & added to cv, enabled in registered_contenthost.
repos = [
repo.read() for repo in module_cv.read().repository if repo.read().url == CUSTOM_REPO_3_URL
]
assert len(repos) > 0
custom_repo = repos[0]
custom_repo.sync()
# Set up rh_repo
rh_repo_id = module_target_sat.api_factory.enable_rhrepo_and_fetchid(
Expand Down Expand Up @@ -570,10 +570,8 @@ def test_host_content_errata_tab_pagination(
assert registered_contenthost.execute(f'yum install -y {pkgs}').status == 0

with session:
# Go to new host's page UI, Content>Errata tab,
# read the view's pagination entitity
session.organization.select(org_name=org.name)
session.location.select(loc_name=DEFAULT_LOC)
# Go to new host's page UI, Content>Errata tab,
# There are two pagination objects on errata tab, we read the top one
pf4_pagination = session.host_new.get_errata_pagination(_chost_name)
assert pf4_pagination.read()
Expand Down Expand Up @@ -677,18 +675,16 @@ def test_host_content_errata_tab_pagination(
assert task.result == 'success'
assert 'host_ids' in task.input
assert registered_contenthost.nailgun_host.id in task.input['host_ids']

# check there are no applicable errata left for Chost
assert registered_contenthost.applicable_errata_count == 0
# The errata table is not present when empty, it should not be paginated.
# timeout is 30s, for tab loading with no pagination {}, on read.
_items = -1
_ex_raised = False
session.browser.refresh()
try:
wait_for(
lambda: not session.host_new.get_errata_pagination(_chost_name).read(),
timeout=20,
timeout=30,
delay=5,
)
except NoSuchElementException:
Expand Down Expand Up @@ -1100,7 +1096,6 @@ def test_positive_content_host_previous_env(
assert vm.execute(f'yum install -y {FAKE_1_CUSTOM_PACKAGE}').status == 0
# Promote the latest content view version to a new lifecycle environment
content_view = module_cv.read()
# lce = content_view_version.environment[-1].read()
new_lce = module_target_sat.api.LifecycleEnvironment(
organization=module_org,
prior=module_lce,
Expand Down Expand Up @@ -1482,6 +1477,7 @@ def test_positive_filtered_errata_status_installable_param(
errata_status_installable,
registered_contenthost,
setting_update,
module_org,
target_sat,
module_lce,
module_cv,
Expand Down Expand Up @@ -1527,11 +1523,12 @@ def test_positive_filtered_errata_status_installable_param(
target_sat.api.ContentViewFilterRule(content_view_filter=cv_filter, errata=errata).create()
module_cv = module_cv.read()
# publish and promote the new version with Filter
module_cv.publish()
module_cv = module_cv.read()
module_cv.version.sort(key=lambda version: version.id)
content_view_version = module_cv.version[-1].read()
content_view_version.promote(data={'environment_ids': module_lce.id})
cv_publish_promote(
target_sat,
module_org,
module_cv,
module_lce,
)

with session:
session.location.select(loc_name=DEFAULT_LOC)
Expand Down

0 comments on commit 7103280

Please sign in to comment.