Skip to content

Commit ae896ed

Browse files
committed
Component Audit: Check org and loc change on Global Registration form
Signed-off-by: Shubham Ganar <[email protected]>
1 parent 885e263 commit ae896ed

File tree

1 file changed

+101
-0
lines changed

1 file changed

+101
-0
lines changed

tests/foreman/ui/test_registration.py

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
"""Tests for registration.
2+
3+
:Requirement: Registration
4+
5+
:CaseLevel: Acceptance
6+
7+
:CaseComponent: Registration
8+
9+
:CaseAutomation: Automated
10+
11+
:CaseImportance: Critical
12+
13+
:Team: Rocket
14+
15+
:TestType: Functional
16+
17+
:Upstream: No
18+
"""
19+
import pytest
20+
21+
from robottelo.utils.datafactory import gen_string
22+
23+
24+
def test_positive_verify_default_values_for_global_registration(
25+
module_target_sat,
26+
default_org,
27+
):
28+
"""Check for all the Default values pre-populated in the global registration template
29+
30+
:id: 34122bf3-ae23-47ca-ba3d-da0653d8fd33
31+
32+
:expectedresults: Default fields in the form should be auto-populated
33+
e.g. organization, location, rex, insights setup, etc
34+
35+
:CaseLevel: Component
36+
37+
:steps:
38+
1. Check for the default values in the global registration template
39+
"""
40+
module_target_sat.cli_factory.make_activation_key(
41+
{'organization-id': default_org.id, 'name': gen_string('alpha')}
42+
)
43+
with module_target_sat.ui_session() as session:
44+
cmd = session.host.get_register_command(
45+
full_read=True,
46+
)
47+
assert cmd['general']['organization'] == 'Default Organization'
48+
assert cmd['general']['location'] == 'Default Location'
49+
assert cmd['general']['capsule'] == 'Nothing to select.'
50+
assert cmd['general']['operating_system'] == ''
51+
assert cmd['general']['host_group'] == 'Nothing to select.'
52+
assert cmd['general']['insecure'] is False
53+
assert cmd['advanced']['setup_rex'] == 'Inherit from host parameter (yes)'
54+
assert cmd['advanced']['setup_insights'] == 'Inherit from host parameter (yes)'
55+
assert cmd['advanced']['token_life_time'] == '4'
56+
assert cmd['advanced']['rex_pull_mode'] == 'Inherit from host parameter (no)'
57+
assert cmd['advanced']['update_packages'] is False
58+
assert cmd['advanced']['ignore_error'] is False
59+
assert cmd['advanced']['force'] is False
60+
61+
62+
@pytest.mark.tier2
63+
def test_positive_org_loc_change_for_registration(
64+
module_activation_key,
65+
module_org,
66+
module_location,
67+
target_sat,
68+
):
69+
"""Changing the organization and location to check if correct org and loc is updated on the global registration page as well as in the command
70+
71+
:id: e83ed6bc-ceae-4021-87fe-3ecde1cbf347
72+
73+
:expectedresults: organization and location is updated correctly on the global registration page as well as in the command.
74+
75+
:CaseLevel: Component
76+
77+
:CaseImportance: Medium
78+
"""
79+
new_org = target_sat.api.Organization().create()
80+
new_loc = target_sat.api.Location().create()
81+
target_sat.api.ActivationKey(organization=new_org).create()
82+
with target_sat.ui_session() as session:
83+
session.organization.select(org_name=module_org.name)
84+
session.location.select(loc_name=module_location.name)
85+
cmd = session.host.get_register_command()
86+
expected_pairs = [
87+
f'organization_id={module_org.id}',
88+
f'location_id={module_location.id}',
89+
]
90+
for pair in expected_pairs:
91+
assert pair in cmd
92+
# changing the org and loc to check if correct org and loc is updated on the registration command
93+
session.organization.select(org_name=new_org.name)
94+
session.location.select(loc_name=new_loc.name)
95+
cmd = session.host.get_register_command()
96+
expected_pairs = [
97+
f'organization_id={new_org.id}',
98+
f'location_id={new_loc.id}',
99+
]
100+
for pair in expected_pairs:
101+
assert pair in cmd

0 commit comments

Comments
 (0)