Skip to content

Commit

Permalink
action on Hostgroup
Browse files Browse the repository at this point in the history
  • Loading branch information
amolpati30 committed Apr 8, 2024
1 parent 3ad7c64 commit a328fc0
Showing 1 changed file with 34 additions and 6 deletions.
40 changes: 34 additions & 6 deletions tests/foreman/ui/test_ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,21 +413,49 @@ def test_positive_remove_role_in_new_ui(self):
"""


@pytest.mark.stubbed
# @pytest.mark.stubbed
@pytest.mark.tier2
def test_positive_assign_and_remove_role_to_hostgroup_in_new_ui(self):
"""Using the new Host UI, add and remove functionality for ansible roles in hostgroup
def test_positive_assign_and_remove_role_to_hostgroup(
module_target_sat, module_org, module_location
):
"""Add and remove functionality for ansible roles in hostgroup
:id: 5d94a484-92c1-4387-ab92-0649e4c4f907
:steps:
1. Import all roles available by default.
2. Create a hostgroup
3. Add some ansible roles to the hostgroup
3. Assign hostgroup to the host
4. Register a RHEL host to Satellite with given hostgroup.
5. Navigate to the new UI for the given hostgroup.
6. Remove the added ansible roles from the hostgroup
6. Add an ansible roles to the hostgroup
7. Remove the added ansible roles from the hostgroup
:expectedresults: The Ansible Role is successfully assign/add/remove from the hostgroup, and no longer shows
up on the UI
"""
"""
SELECTED_ROLE = 'RedHatInsights.insights-client'

hostgroup = module_target_sat.api.HostGroup(
location=[module_location], organization=[module_org]
).create()
host = module_target_sat.api.Host(
organization=module_org, location=module_location, hostgroup=hostgroup
).create()
location = host.location.read()
organization = host.organization.read()
with module_target_sat.ui_session() as session:
session.location.select(location.name)
session.organization.select(organization.name)
# assign ansible role to host-group
session.host_new.assign_role_to_hostgroup(host.name)
# verify ansible role assigned to new UI for given host-group
assert (
session.hostgroup.read(
host.hostgroup.read().name, widget_names='ansible_roles.assigned_role'
)['ansible_roles']['assigned_role'].split('. ')[1]
) == SELECTED_ROLE

remove_role = session.host_new.remove_hostgroup_role(host.name)
# verify ansible role removed in host-group
assert remove_role != SELECTED_ROLE

0 comments on commit a328fc0

Please sign in to comment.