Skip to content

Commit

Permalink
Finish extension for RHEL lifecycle status
Browse files Browse the repository at this point in the history
  • Loading branch information
damoore044 committed Dec 11, 2023
1 parent b79a4fb commit e45d207
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions tests/foreman/ui/test_contenthost.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,23 +117,21 @@ def get_rhel_lifecycle_support(rhel_version):
:param rhel_version: integer of the current base rhel version
:return: string with the expected status of rhel version support
"""
rhels = get_supported_rhel_versions()
rhels = sorted(get_supported_rhel_versions(), reverse=True)
rhel_lifecycle_status = 'Unknown'
if rhel_version not in rhels:
return rhel_lifecycle_status
elif (len(rhels) - 1) - rhels.index(rhel_version) <= 1:
elif rhels.index(rhel_version) <= 1:
rhel_lifecycle_status = 'Full support'
elif (len(rhels) - 1) - rhels.index(rhel_version) == 2:
elif rhels.index(rhel_version) == 2:
rhel_lifecycle_status = 'Approaching end of maintenance support'
elif (len(rhels) - 1) - rhels.index(rhel_version) >= 3:
elif rhels.index(rhel_version) >= 3:
rhel_lifecycle_status = 'End of maintenance support'

return rhel_lifecycle_status


@pytest.mark.e2e
@pytest.mark.tier3
@pytest.mark.parametrize('setting_update', ['new_hosts_page'], indirect=True)
@pytest.mark.parametrize(
'module_repos_collection_with_manifest',
[
Expand All @@ -154,7 +152,6 @@ def test_positive_end_to_end(
vm,
session,
module_org,
setting_update,
default_location,
module_repos_collection_with_manifest,
):
Expand All @@ -172,7 +169,7 @@ def test_positive_end_to_end(
:CaseImportance: Critical
"""
property_name = setting_update.name

_distro = module_repos_collection_with_manifest.distro
host_rhel_version = None
if _distro.startswith('rhel'):
Expand All @@ -183,16 +180,13 @@ def test_positive_end_to_end(
assert result.status == 0
startdate = datetime.utcnow().strftime('%m/%d/%Y')
with session:
session.settings.update(f'name = {property_name}', 'Yes')
session.location.select(default_location.name)
session.organization.select(module_org.name)
# Use new hosts UI, only check the details and host status
host_details = session.host.get_details(vm.hostname, widget_names='properties')
host_status = session.host_new.get_host_statuses(vm.hostname)
# Use old hosts UI for remainder
session.settings.update(f'name = {property_name}', 'No')
assert rhel_status in host_status['RHEL lifecycle']['Status']
assert rhel_status in host_details['properties']['properties_table']['RHEL lifecycle']
# Ensure host status and details show correct RHEL lifecycle status
host_status = session.host.host_status(vm.hostname)
host_rhel_lcs = session.contenthost.read(vm.hostname, widget_names=['permission_denied'])
assert rhel_status in host_rhel_lcs['permission_denied']
assert rhel_status in host_status
# Ensure content host is searchable
assert session.contenthost.search(vm.hostname)[0]['Name'] == vm.hostname
chost = session.contenthost.read(
Expand Down

0 comments on commit e45d207

Please sign in to comment.