Skip to content

Commit f74551a

Browse files
ColeHiggins2web-flow
authored andcommitted
update test for enable/disable recommendations (IoP) (#20520)
* update test for enable disable iop * Fix failing tests and fixture * pre-commit * update pytest marker * add enable functionality to iop * update pytest marker * update test with new entity * update to rhel 10 for recommendations (cherry picked from commit 0b9ef3c)
1 parent a6567f8 commit f74551a

1 file changed

Lines changed: 24 additions & 17 deletions

File tree

tests/foreman/ui/test_rhcloud_iop.py

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -280,15 +280,15 @@ def test_rhcloud_inventory_disabled_local_insights(module_target_sat_insights):
280280

281281
@pytest.mark.e2e
282282
@pytest.mark.no_containers
283-
@pytest.mark.rhel_ver_match(r'^(?![78]).*')
283+
@pytest.mark.rhel_ver_match('10')
284284
@pytest.mark.parametrize('module_target_sat_insights', [False], ids=['local'], indirect=True)
285285
def test_iop_recommendations_remediation_type_and_status(
286286
rhel_insights_vm,
287287
rhcloud_manifest_org,
288288
module_target_sat_insights,
289289
):
290290
"""Set up Satellite with iop enabled, verify recommendations remediation type,
291-
and test filtering recommendations by status.
291+
disable the recommendation, check status, then re-enable the recommendation.
292292
293293
:id: 62834698-b4b8-4218-855c-2b2aa584b364
294294
@@ -297,21 +297,18 @@ def test_iop_recommendations_remediation_type_and_status(
297297
2. In Satellite UI, go to Red Hat Lightspeed > Recommendations.
298298
3. Search for "OpenSSH config permissions" recommendation.
299299
4. Verify the recommendation's remediation type is "Playbook".
300-
5. Apply filter for "Enabled" status recommendations.
301-
6. Verify Enabled recommendations are greater than 0.
302-
7. Apply filter for "Disabled" status recommendations.
303-
8. Verify Disabled recommendations are 0.
300+
5. Disable recommendation.
301+
6. Verify recommendation is disabled.
302+
7. Re-enable recommendation.
303+
8. Verify recommendation is enabled.
304304
305305
:expectedresults:
306306
1. Red Hat Lightspeed recommendation related to "OpenSSH config permissions" issue is listed
307307
for misconfigured machine.
308308
2. The recommendation has remediation type "Playbook".
309-
3. Enabled recommendations are displayed (count greater than 0).
310-
4. No disabled recommendations are displayed.
309+
3. Recommendation can be disabled and re-enabled.
311310
312-
:CaseImportance: Critical
313-
314-
:Verifies: SAT-32566
311+
:Verifies: SAT-32566, SAT-38139
315312
316313
:parametrized: yes
317314
@@ -338,10 +335,20 @@ def test_iop_recommendations_remediation_type_and_status(
338335
assert result[0]['Name'] == OPENSSH_RECOMMENDATION
339336
assert result[0]['Remediation type'] == 'Playbook'
340337

341-
# Verify that enabled recommendations are greater than 0
342-
result = session.recommendationstab.apply_filter("Status", "Enabled")
343-
assert len(result) > 0
344-
345-
# Verify that Disabled recommnedations are 0
338+
# Disable recommendation
339+
session.recommendationstab.disable_recommendation(
340+
recommendation_name=OPENSSH_RECOMMENDATION
341+
)
342+
# Verify that the disabled recommendation is filtered
346343
result = session.recommendationstab.apply_filter("Status", "Disabled")
347-
assert 'No recommendations' in result[0]['Name']
344+
assert 'Decreased security: OpenSSH config permissions' in result[0]['Name']
345+
346+
session.recommendationstab.enable_recommendation(
347+
recommendation_name='Decreased security: OpenSSH config permissions'
348+
)
349+
# Verify that recommendation is enabled
350+
session.recommendationstab.apply_filter("Status", "Enabled")
351+
result = session.recommendationstab.apply_filter(
352+
"Name", OPENSSH_RECOMMENDATION, is_search=True
353+
)
354+
assert 'Decreased security: OpenSSH config permissions' in result[0]['Name']

0 commit comments

Comments
 (0)