Skip to content

Commit f2f633d

Browse files
Move bool_in_query Hosts test (#20342)
move_bool_in_query_hosts_test
1 parent e4757e5 commit f2f633d

File tree

2 files changed

+39
-35
lines changed

2 files changed

+39
-35
lines changed

tests/foreman/ui/test_contenthost.py

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,38 +1306,3 @@ def test_search_for_virt_who_hypervisors(session, default_location, module_targe
13061306
# Search with hypervisor=false gives the correct result.
13071307
content_hosts = [host['Name'] for host in session.contenthost.search('hypervisor = false')]
13081308
assert hypervisor_display_name not in content_hosts
1309-
1310-
1311-
@pytest.mark.rhel_ver_match([settings.content_host.default_rhel_version])
1312-
def test_content_hosts_bool_in_query(module_target_sat, rhcloud_manifest_org, rhel_insights_vm):
1313-
"""
1314-
Test that the 'true'/'false' string is also
1315-
interpreted as a boolean true/false as it is happening for 't'/'f' string
1316-
1317-
:id: 1daa297d-aa16-4211-9b1b-23e63c09b0e1
1318-
1319-
:verifies: SAT-22655
1320-
"""
1321-
search_queries = {
1322-
'True': [
1323-
'params.host_registration_insights = true',
1324-
'params.host_registration_insights = t',
1325-
],
1326-
'False': [
1327-
'params.host_registration_insights = false',
1328-
'params.host_registration_insights = f',
1329-
],
1330-
}
1331-
1332-
with module_target_sat.ui_session() as session:
1333-
session.organization.select(rhcloud_manifest_org.name)
1334-
for query_type, queries in search_queries.items():
1335-
for query in queries:
1336-
session.contenthost.search(query)
1337-
result = session.contenthost.read_all()
1338-
if query_type == 'True':
1339-
assert result['table'][0]['Name'] == rhel_insights_vm.hostname
1340-
elif query_type == 'False' and result['table']:
1341-
assert all(
1342-
item['Name'] != rhel_insights_vm.hostname for item in result['table']
1343-
)

tests/foreman/ui/test_rhcloud_insights.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,3 +481,42 @@ def test_insights_registration_with_capsule(
481481
# Verify that Insights status again.
482482
values = session.host_new.get_host_statuses(rhel_contenthost.hostname)
483483
assert values['Red Hat Lightspeed']['Status'] == 'Reporting'
484+
485+
486+
@pytest.mark.rhel_ver_match([settings.content_host.default_rhel_version])
487+
def test_positive_content_hosts_bool_in_query(
488+
module_target_sat, rhcloud_manifest_org, rhel_insights_vm
489+
):
490+
"""
491+
Test that the 'true'/'false' string is also
492+
interpreted as a boolean true/false as it is happening for 't'/'f' string
493+
494+
:id: 1daa297d-aa16-4211-9b1b-23e63c09b0e1
495+
496+
:verifies: SAT-22655
497+
498+
:CaseComponent: Hosts
499+
"""
500+
search_queries = {
501+
'True': [
502+
'params.host_registration_insights = true',
503+
'params.host_registration_insights = t',
504+
],
505+
'False': [
506+
'params.host_registration_insights = false',
507+
'params.host_registration_insights = f',
508+
],
509+
}
510+
511+
with module_target_sat.ui_session() as session:
512+
session.organization.select(rhcloud_manifest_org.name)
513+
for query_type, queries in search_queries.items():
514+
for query in queries:
515+
session.contenthost.search(query)
516+
result = session.contenthost.read_all()
517+
if query_type == 'True':
518+
assert result['table'][0]['Name'] == rhel_insights_vm.hostname
519+
elif query_type == 'False' and result['table']:
520+
assert all(
521+
item['Name'] != rhel_insights_vm.hostname for item in result['table']
522+
)

0 commit comments

Comments
 (0)