Skip to content

Commit

Permalink
Ansible Host Details Test (#10155)
Browse files Browse the repository at this point in the history
* WIP test for Ansible Host Details

* Fix test and add check for modal dialogue
  • Loading branch information
sambible authored Feb 27, 2023
1 parent c52f224 commit 7040c28
Showing 1 changed file with 91 additions and 80 deletions.
171 changes: 91 additions & 80 deletions tests/foreman/ui/test_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -2751,115 +2751,126 @@ def test_positive_set_multi_line_and_with_spaces_parameter_value(
assert host_parameters[param_name] == param_value


class TestHostAnsible:
"""Tests for Ansible portion of Hosts"""
@pytest.mark.tier2
def test_positive_host_role_information(target_sat, function_host):
"""Assign Ansible Role to a Host and verify that the information
in the new UI is displayed correctly
@pytest.mark.stubbed
@pytest.mark.tier2
def test_positive_host_role_information(self):
"""Assign Ansible Role to a Host and an attached Host group and verify that the information
in the new UI is displayed correctly
:id: 7da913ef-3b43-4bfa-9a45-d895431c8b56
:id: 7da913ef-3b43-4bfa-9a45-d895431c8b56
:caseComponent: Ansible
:caseComponent: Ansible
:Team: Rocket
:Team: Rocket
:CaseLevel: System
:CaseLevel: System
:Steps:
1. Register a RHEL host to Satellite.
2. Import all roles available by default.
3. Assign one role to the RHEL host.
4. Navigate to the new UI for the given Host.
5. Select the 'Ansible' tab, then the 'Inventory' sub-tab.
:Steps:
1. Register a RHEL host to Satellite.
2. Import all roles available by default.
3. Create a host group and assign one of the Ansible roles to the host group.
4. Assign the host to the host group.
5. Assign one role to the RHEL host.
6. Navigate to the new UI for the given Host.
7. Select the 'Ansible' tab, then the 'Inventory' sub-tab.
:expectedresults: Roles assigned directly to the Host are visible on the subtab.
:expectedresults: Roles assigned directly to the Host are visible on the subtab, and
roles assigned to the Host Group are visible by clicking the "view all assigned
roles" link
"""
SELECTED_ROLE = 'RedHatInsights.insights-client'

location = function_host.location.read()
organization = function_host.organization.read()
proxy_id = target_sat.nailgun_smart_proxy.id
target_sat.api.AnsibleRoles().sync(data={'proxy_id': proxy_id, 'role_names': [SELECTED_ROLE]})
function_host.assign_ansible_roles(data={'ansible_role_ids': [1]})
host_roles = function_host.list_ansible_roles()
assert host_roles[0]['name'] == SELECTED_ROLE
with target_sat.ui_session() as session:
session.location.select(location.name)
session.organization.select(organization.name)
ansible_roles_table = session.host_new.get_ansible_roles(function_host.name)
assert ansible_roles_table[0]["Name"] == SELECTED_ROLE
all_assigned_roles_table = session.host_new.get_ansible_roles_modal(function_host.name)
assert all_assigned_roles_table[0]["Name"] == SELECTED_ROLE


@pytest.mark.stubbed
@pytest.mark.tier2
def test_positive_role_variable_information(self):
"""Create and assign variables to an Ansible Role and verify that the information in
the new UI is displayed correctly
"""
:id: 4ab2813a-6b83-4907-b104-0473465814f5
@pytest.mark.stubbed
@pytest.mark.tier2
def test_positive_role_variable_information(self):
"""Create and assign variables to an Ansible Role and verify that the information in
the new UI is displayed correctly
:caseComponent: Ansible
:id: 4ab2813a-6b83-4907-b104-0473465814f5
:Team: Rocket
:caseComponent: Ansible
:CaseLevel: System
:Team: Rocket
:Steps:
1. Register a RHEL host to Satellite.
2. Import all roles available by default.
3. Create a host group and assign one of the Ansible roles to the host group.
4. Assign the host to the host group.
5. Assign one roles to the RHEL host.
6. Create a variable and associate it with the role assigned to the Host.
7. Create a variable and associate it with the role assigned to the Hostgroup.
8. Navigate to the new UI for the given Host.
9. Select the 'Ansible' tab, then the 'Variables' sub-tab.
:CaseLevel: System
:expectedresults: The variables information for the given Host is visible.
:Steps:
1. Register a RHEL host to Satellite.
2. Import all roles available by default.
3. Create a host group and assign one of the Ansible roles to the host group.
4. Assign the host to the host group.
5. Assign one roles to the RHEL host.
6. Create a variable and associate it with the role assigned to the Host.
7. Create a variable and associate it with the role assigned to the Hostgroup.
8. Navigate to the new UI for the given Host.
9. Select the 'Ansible' tab, then the 'Variables' sub-tab.
"""

:expectedresults: The variables information for the given Host is visible.

"""
@pytest.mark.stubbed
@pytest.mark.tier2
def test_positive_assign_role_in_new_ui(self):
"""Using the new Host UI, assign a role to a Host
@pytest.mark.stubbed
@pytest.mark.tier2
def test_positive_assign_role_in_new_ui(self):
"""Using the new Host UI, assign a role to a Host
:id: 044f38b4-cff2-4ddc-b93c-7e9f2826d00d
:id: 044f38b4-cff2-4ddc-b93c-7e9f2826d00d
:caseComponent: Ansible
:caseComponent: Ansible
:Team: Rocket
:Team: Rocket
:CaseLevel: System
:CaseLevel: System
:Steps:
1. Register a RHEL host to Satellite.
2. Import all roles available by default.
3. Navigate to the new UI for the given Host.
4. Select the 'Ansible' tab
5. Click the 'Assign Ansible Roles' button.
6. Using the popup, assign a role to the Host.
:Steps:
1. Register a RHEL host to Satellite.
2. Import all roles available by default.
3. Navigate to the new UI for the given Host.
4. Select the 'Ansible' tab
5. Click the 'Assign Ansible Roles' button.
6. Using the popup, assign a role to the Host.
:expectedresults: The Role is successfully assigned to the Host, and shows up on the UI
:expectedresults: The Role is successfully assigned to the Host, and shows up on the UI
"""

"""

@pytest.mark.stubbed
@pytest.mark.tier2
def test_positive_remove_role_in_new_ui(self):
"""Using the new Host UI, remove the role(s) of a Host
@pytest.mark.stubbed
@pytest.mark.tier2
def test_positive_remove_role_in_new_ui(self):
"""Using the new Host UI, remove the role(s) of a Host
:id: d6de5130-45f6-4349-b490-fbde2aed082c
:id: d6de5130-45f6-4349-b490-fbde2aed082c
:caseComponent: Ansible
:caseComponent: Ansible
:Team: Rocket
:Team: Rocket
:CaseLevel: System
:CaseLevel: System
:Steps:
1. Register a RHEL host to Satellite.
2. Import all roles available by default.
3. Assign a role to the host.
4. Navigate to the new UI for the given Host.
5. Select the 'Ansible' tab
6. Click the 'Edit Ansible roles' button.
7. Using the popup, remove the assigned role from the Host.
:Steps:
1. Register a RHEL host to Satellite.
2. Import all roles available by default.
3. Assign a role to the host.
4. Navigate to the new UI for the given Host.
5. Select the 'Ansible' tab
6. Click the 'Edit Ansible roles' button.
7. Using the popup, remove the assigned role from the Host.
:expectedresults: The Role is successfully removed from the Host, and no longer shows
up on the UI
:expectedresults: The Role is successfully removed from the Host, and no longer shows
up on the UI
"""
"""

0 comments on commit 7040c28

Please sign in to comment.