Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherrypick of 6.15 tests to 6.15.z #13649

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions tests/foreman/ui/test_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,20 @@ def tracer_install_host(rex_contenthost, target_sat):
return rex_contenthost


@pytest.fixture
def new_host_ui(target_sat):
"""Changes the setting to use the New All Host UI
then returns it back to the normal value"""
all_hosts_setting = target_sat.api.Setting().search(
query={'search': f'name={"new_hosts_page"}'}
)[0]
all_hosts_setting.value = 'True'
all_hosts_setting.update({'value'})
yield
all_hosts_setting.value = 'False'
all_hosts_setting.update({'value'})


@pytest.mark.e2e
@pytest.mark.tier2
def test_positive_end_to_end(session, module_global_params, target_sat, host_ui_options):
Expand Down Expand Up @@ -2433,3 +2447,46 @@ def test_positive_host_registration_with_non_admin_user(
# Verify server.hostname and server.port from subscription-manager config
assert target_sat.hostname == rhel8_contenthost.subscription_config['server']['hostname']
assert constants.CLIENT_PORT == rhel8_contenthost.subscription_config['server']['port']


@pytest.mark.tier2
def test_all_hosts_delete(session, target_sat, function_org, function_location, new_host_ui):
"""Create a host and delete it through All Hosts UI

:id: 42b4560c-bb57-4c58-928e-e5fd5046b93f

:expectedresults: Successful deletion of a host through the table dropdown

:CaseComponent:Hosts-Content

:Team: Phoenix-subscriptions

:CaseLevel: System
"""
host = target_sat.api.Host(organization=function_org, location=function_location).create()
with target_sat.ui_session() as session:
session.organization.select(function_org.name)
session.location.select(function_location.name)
assert session.all_hosts.delete(host.name)


@pytest.mark.tier2
def test_all_hosts_bulk_delete(session, target_sat, function_org, function_location, new_host_ui):
"""Create several hosts, and delete them via Bulk Actions in All Hosts UI

:id: af1b4a66-dd83-47c3-904b-e8627119cc53

:expectedresults: Successful deletion of multiple hosts at once through Bulk Action

:CaseComponent:Hosts-Content

:Team: Phoenix-subscriptions

:CaseLevel: System
"""
for _ in range(10):
target_sat.api.Host(organization=function_org, location=function_location).create()
with target_sat.ui_session() as session:
session.organization.select(function_org.name)
session.location.select(function_location.name)
assert session.all_hosts.bulk_delete_all()