Skip to content

Commit

Permalink
update whole test to use host_new
Browse files Browse the repository at this point in the history
  • Loading branch information
mstrlc committed Sep 13, 2023
1 parent 1e9f7bf commit d1fcd8c
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions tests/foreman/ui/test_rhcloud_insights.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,25 +300,28 @@ def test_host_details_page(
handle_exception=True,
)
# Verify Insights status of host.
result = session.host.host_status(rhel_insights_vm.hostname)
assert 'Insights: Reporting' in result
assert 'Inventory: Successfully uploaded to your RH cloud inventory' in result
result = session.host.search(rhel_insights_vm.hostname)[0]
result = session.host_new.get_host_statuses(rhel_insights_vm.hostname)
assert result['Insights']['Status'] == 'Reporting'
assert result['Inventory']['Status'] == 'Successfully uploaded to your RH cloud inventory'
result = session.host_new.search(rhel_insights_vm.hostname)[0]
assert result['Name'] == rhel_insights_vm.hostname
assert int(result['Recommendations']) > 0
values = session.host_new.get_host_statuses(rhel_insights_vm.hostname)
assert values['Inventory']['Status'] == 'Successfully uploaded to your RH cloud inventory'
# Read the recommendations listed in Insights tab present on host details page
insights_recommendations = session.host_new.insights_tab(rhel_insights_vm.hostname)
insights_recommendations = session.host_new.get_insights(rhel_insights_vm.hostname)[
'recommendations_table'
]
for recommendation in insights_recommendations:
if recommendation['name'] == DNF_RECOMMENDATION:
assert recommendation['label'] == 'Moderate'
assert DNF_RECOMMENDATION in recommendation['text']
if recommendation['Recommendation'] == DNF_RECOMMENDATION:
assert recommendation['Total risk'] == 'Moderate'
assert DNF_RECOMMENDATION in recommendation['Recommendation']
assert len(insights_recommendations) == int(result['Recommendations'])
# Test Recommendation button present on host details page
recommendations = session.host.read_insights_recommendations(rhel_insights_vm.hostname)
recommendations = session.host_new.get_insights(rhel_insights_vm.hostname)[
'recommendations_table'
]
assert len(recommendations), 'No recommendations were found'
assert recommendations[0]['Hostname'] == rhel_insights_vm.hostname
assert int(result['Recommendations']) == len(recommendations)
# Delete host
rhel_insights_vm.nailgun_host.delete()
Expand Down

0 comments on commit d1fcd8c

Please sign in to comment.