1616
1717from robottelo import constants
1818
19+ # Constants for CVE vulnerability testing
20+ CVE_ID = 'CVE-2025-8058'
21+
22+
23+ @pytest .fixture
24+ def vulnerable_rhel_host (rhel_insights_vm ):
25+ """Fixture to prepare a RHEL host with a vulnerable package"""
26+ GLIBC_RPM = 'glibc-2.39-43.el10_0.x86_64'
27+ client = rhel_insights_vm
28+ # Remove any static repos and update to the latest packages available from the Satellite
29+ assert (
30+ client .execute (
31+ "find /etc/yum.repos.d/ -type f | grep -vF redhat.repo | xargs -I '{}' rm '{}'"
32+ ).status
33+ == 0
34+ )
35+ assert client .execute ('dnf -y update' ).status == 0
36+ # Downgrade to vulnerable glibc version
37+ assert client .execute (f'dnf downgrade -y { GLIBC_RPM } ' ).status == 0
38+ return client
39+
1940
2041@pytest .fixture (scope = 'module' )
2142def setup_content_for_iop (module_target_sat_insights , rhcloud_manifest_org ):
@@ -122,14 +143,14 @@ def test_rhcloud_insights_vulnerabilities_e2e(
122143@pytest .mark .rhel_ver_list ([10 ])
123144@pytest .mark .parametrize ('module_target_sat_insights' , [False ], ids = ['local' ], indirect = True )
124145def test_edit_business_risk_and_status_individual (
125- rhel_insights_vm ,
146+ vulnerable_rhel_host ,
126147 rhcloud_manifest_org ,
127148 module_target_sat_insights ,
128149 setup_content_for_iop ,
129150):
130151 """Test editing business risk and status for individual CVEs from the table
131152
132- :id: TODO-generate-uuid
153+ :id: a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d
133154
134155 :steps:
135156 1. Create a CVE by downgrading a vulnerable package
@@ -144,27 +165,8 @@ def test_edit_business_risk_and_status_individual(
144165 2. Status can be edited and persists in the table
145166
146167 :CaseImportance: High
147-
148- :BZ: TODO-add-bugzilla-if-needed
149168 """
150- CVE_ID = 'CVE-2025-8058'
151- GLIBC_RPM = 'glibc-2.39-43.el10_0.x86_64'
152-
153169 satellite = module_target_sat_insights
154- client = rhel_insights_vm
155-
156- # Set up the CVE by downgrading to a vulnerable package version
157- # Remove any static repos and update to the latest packages available from the Satellite
158- assert (
159- client .execute (
160- "find /etc/yum.repos.d/ -type f | grep -vF redhat.repo | xargs -I '{}' rm '{}'"
161- ).status
162- == 0
163- )
164- assert client .execute ('dnf -y update' ).status == 0
165-
166- # Downgrade to vulnerable glibc version
167- assert client .execute (f'dnf downgrade -y { GLIBC_RPM } ' ).status == 0
168170
169171 with satellite .ui_session () as session :
170172 session .organization .select (org_name = rhcloud_manifest_org .name )
@@ -195,7 +197,7 @@ def test_edit_business_risk_and_status_individual(
195197@pytest .mark .rhel_ver_list ([10 ])
196198@pytest .mark .parametrize ('module_target_sat_insights' , [False ], ids = ['local' ], indirect = True )
197199def test_bulk_edit_business_risk_and_status (
198- rhel_insights_vm ,
200+ vulnerable_rhel_host ,
199201 rhcloud_manifest_org ,
200202 module_target_sat_insights ,
201203 setup_content_for_iop ,
@@ -220,21 +222,7 @@ def test_bulk_edit_business_risk_and_status(
220222
221223 :CaseImportance: High
222224 """
223- CVE_ID = 'CVE-2025-8058'
224- GLIBC_RPM = 'glibc-2.39-43.el10_0.x86_64'
225-
226225 satellite = module_target_sat_insights
227- client = rhel_insights_vm
228-
229- # Set up the CVE by downgrading to a vulnerable package version
230- assert (
231- client .execute (
232- "find /etc/yum.repos.d/ -type f | grep -vF redhat.repo | xargs -I '{}' rm '{}'"
233- ).status
234- == 0
235- )
236- assert client .execute ('dnf -y update' ).status == 0
237- assert client .execute (f'dnf downgrade -y { GLIBC_RPM } ' ).status == 0
238226
239227 with satellite .ui_session () as session :
240228 session .organization .select (org_name = rhcloud_manifest_org .name )
@@ -278,7 +266,7 @@ def test_bulk_edit_business_risk_and_status(
278266@pytest .mark .rhel_ver_list ([10 ])
279267@pytest .mark .parametrize ('module_target_sat_insights' , [False ], ids = ['local' ], indirect = True )
280268def test_edit_from_cve_details_page (
281- rhel_insights_vm ,
269+ vulnerable_rhel_host ,
282270 rhcloud_manifest_org ,
283271 module_target_sat_insights ,
284272 setup_content_for_iop ,
@@ -303,21 +291,7 @@ def test_edit_from_cve_details_page(
303291
304292 :CaseImportance: High
305293 """
306- CVE_ID = 'CVE-2025-8058'
307- GLIBC_RPM = 'glibc-2.39-43.el10_0.x86_64'
308-
309294 satellite = module_target_sat_insights
310- client = rhel_insights_vm
311-
312- # Set up the CVE by downgrading to a vulnerable package version
313- assert (
314- client .execute (
315- "find /etc/yum.repos.d/ -type f | grep -vF redhat.repo | xargs -I '{}' rm '{}'"
316- ).status
317- == 0
318- )
319- assert client .execute ('dnf -y update' ).status == 0
320- assert client .execute (f'dnf downgrade -y { GLIBC_RPM } ' ).status == 0
321295
322296 with satellite .ui_session () as session :
323297 session .organization .select (org_name = rhcloud_manifest_org .name )
@@ -350,7 +324,7 @@ def test_edit_from_cve_details_page(
350324@pytest .mark .rhel_ver_list ([10 ])
351325@pytest .mark .parametrize ('module_target_sat_insights' , [False ], ids = ['local' ], indirect = True )
352326def test_filter_by_os_version (
353- rhel_insights_vm ,
327+ vulnerable_rhel_host ,
354328 rhcloud_manifest_org ,
355329 module_target_sat_insights ,
356330 setup_content_for_iop ,
@@ -373,21 +347,7 @@ def test_filter_by_os_version(
373347
374348 :CaseImportance: High
375349 """
376- CVE_ID = 'CVE-2025-8058'
377- GLIBC_RPM = 'glibc-2.39-43.el10_0.x86_64'
378-
379350 satellite = module_target_sat_insights
380- client = rhel_insights_vm
381-
382- # Set up the CVE by downgrading to a vulnerable package version
383- assert (
384- client .execute (
385- "find /etc/yum.repos.d/ -type f | grep -vF redhat.repo | xargs -I '{}' rm '{}'"
386- ).status
387- == 0
388- )
389- assert client .execute ('dnf -y update' ).status == 0
390- assert client .execute (f'dnf downgrade -y { GLIBC_RPM } ' ).status == 0
391351
392352 with satellite .ui_session () as session :
393353 session .organization .select (org_name = rhcloud_manifest_org .name )
0 commit comments