From 86767450a5309ff46b14b72eb5545b609f61cf6d Mon Sep 17 00:00:00 2001 From: Shubham Ganar Date: Mon, 18 Dec 2023 16:41:39 +0530 Subject: [PATCH] Component Audit: Check org and loc change on Global Registration form Signed-off-by: Shubham Ganar --- tests/foreman/ui/test_registration.py | 61 +++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 tests/foreman/ui/test_registration.py diff --git a/tests/foreman/ui/test_registration.py b/tests/foreman/ui/test_registration.py new file mode 100644 index 00000000000..928c545de3e --- /dev/null +++ b/tests/foreman/ui/test_registration.py @@ -0,0 +1,61 @@ +"""Tests for registration. + +:Requirement: Registration + +:CaseLevel: Acceptance + +:CaseComponent: Registration + +:CaseAutomation: Automated + +:CaseImportance: Critical + +:Team: Rocket + +:TestType: Functional + +:Upstream: No +""" + +import pytest + + +@pytest.mark.tier2 +def test_positive_org_loc_change_for_registration( + module_activation_key, + module_org, + module_location, + target_sat, +): + """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 + + :id: e83ed6bc-ceae-4021-87fe-3ecde1cbf347 + + :expectedresults: organization and location is updated correctly on the global registration page as well as in the command. + + :CaseLevel: Component + + :CaseImportance: Medium + """ + new_org = target_sat.api.Organization().create() + new_loc = target_sat.api.Location().create() + target_sat.api.ActivationKey(organization=new_org).create() + + with target_sat.ui_session() as session: + cmd = session.host.get_register_command() + expected_pairs = [ + f'organization_id={module_org.id}', + f'location_id={module_location.id}', + ] + for pair in expected_pairs: + assert pair in cmd + # changing the org and loc to check if correct org and loc is updated on the registration command + session.organization.select(org_name=new_org.name) + session.location.select(loc_name=new_loc.name) + cmd = session.host.get_register_command() + expected_pairs = [ + f'organization_id={new_org.id}', + f'location_id={new_loc.id}', + ] + for pair in expected_pairs: + assert pair in cmd