From 0d9d8a71c5dfc709419ec4dad78e3d1593d17b1d Mon Sep 17 00:00:00 2001 From: Shweta Singh Date: Tue, 16 Apr 2024 17:52:55 +0530 Subject: [PATCH] Remove the sub-man status (#14783) --- tests/foreman/cli/test_registration.py | 59 ++++++++++++++++++++++++++ tests/foreman/ui/test_jobinvocation.py | 51 ---------------------- 2 files changed, 59 insertions(+), 51 deletions(-) diff --git a/tests/foreman/cli/test_registration.py b/tests/foreman/cli/test_registration.py index 9071ecc770a..439ed9fac4d 100644 --- a/tests/foreman/cli/test_registration.py +++ b/tests/foreman/cli/test_registration.py @@ -12,9 +12,12 @@ """ import pytest +import re +from fauxfactory import gen_string from robottelo.config import settings from robottelo.constants import CLIENT_PORT +from robottelo.exceptions import CLIReturnCodeError pytestmark = pytest.mark.tier1 @@ -164,3 +167,59 @@ def test_negative_register_twice(module_ak_with_cv, module_org, rhel_contenthost # host being already registered. assert result.status == 1 assert 'This system is already registered' in str(result.stderr) + + + +@pytest.mark.rhel_ver_match('[^6]') +@pytest.mark.tier3 +def test_positive_force_register_twice(module_ak_with_cv, module_org, rhel_contenthost, target_sat): + """Register a host twice to Satellite, with force=true + + :id: 7ccd4efd-54bb-4207-9acf-4c6243a32fab + + :expectedresults: Host will be re-registered + + :parametrized: yes + + :BZ: 1361309 + + :customerscenario: true + """ + reg_id_pattern = r"The system has been registered with ID: ([^\n]*)" + name = gen_string('alpha') + ".example.com" + rhel_contenthost.execute(f'hostnamectl set-hostname {name}') + result = rhel_contenthost.register(module_org, None, module_ak_with_cv.name, target_sat) + reg_id_old = re.search(reg_id_pattern, result.stdout).group(1) + assert result.status == 0 + assert rhel_contenthost.subscribed + result = rhel_contenthost.register( + module_org, None, module_ak_with_cv.name, target_sat, force=True + ) + assert result.status == 0 + assert rhel_contenthost.subscribed + assert f'Unregistering from: {target_sat.hostname}' in str(result.stdout) + assert f'The registered system name is: {rhel_contenthost.hostname}' in str(result.stdout) + reg_id_new = re.search(reg_id_pattern, result.stdout).group(1) + assert f'The system has been registered with ID: {reg_id_new}' in str(result.stdout) + assert reg_id_new != reg_id_old + assert ( + target_sat.cli.Host.info({'name': rhel_contenthost.hostname}, output_format='json')[ + 'subscription-information' + ]['uuid'] + == reg_id_new + ) + +@pytest.mark.tier1 +def test_negative_global_registration_without_ak(module_target_sat): + """Attempt to register a host without ActivationKey + + :id: e48a6260-97e0-4234-a69c-77bbbcde85df + + :expectedresults: Generate command is disabled without ActivationKey + """ + with pytest.raises(CLIReturnCodeError) as context: + module_target_sat.cli.HostRegistration.generate_command(options=None) + assert ( + 'Failed to generate registration command:\n Missing activation key!' + in context.value.message + ) \ No newline at end of file diff --git a/tests/foreman/ui/test_jobinvocation.py b/tests/foreman/ui/test_jobinvocation.py index d79d7ee3355..e7c2e9252cc 100644 --- a/tests/foreman/ui/test_jobinvocation.py +++ b/tests/foreman/ui/test_jobinvocation.py @@ -118,54 +118,3 @@ def test_positive_run_custom_job_template_by_ip( status = session.jobinvocation.read(entity_name=job_description, host_name=hostname) assert status['overview']['hosts_table'][0]['Status'] == 'success' - -@pytest.mark.stubbed -@pytest.mark.tier2 -def test_positive_schedule_recurring_host_job(self): - """Using the new Host UI, schedule a recurring job on a Host - - :id: 5052be04-28ab-4349-8bee-851ef76e4ffa - - :caseComponent: Ansible-RemoteExecution - - :Team: Rocket - - :steps: - 1. Register a RHEL host to Satellite. - 2. Import all roles available by default. - 3. Assign a role to host. - 4. Navigate to the new UI for the given Host. - 5. Select the Jobs subtab. - 6. Click the Schedule Recurring Job button, and using the popup, schedule a - recurring Job. - 7. Navigate to Job Invocations. - - :expectedresults: The scheduled Job appears in the Job Invocation list at the appointed - time - """ - - -@pytest.mark.stubbed -@pytest.mark.tier2 -def test_positive_schedule_recurring_hostgroup_job(self): - """Using the new recurring job scheduler, schedule a recurring job on a Hostgroup - - :id: c65db99b-11fe-4a32-89d0-0a4692b07efe - - :caseComponent: Ansible-RemoteExecution - - :Team: Rocket - - :steps: - 1. Register a RHEL host to Satellite. - 2. Import all roles available by default. - 3. Assign a role to host. - 4. Navigate to the Host Group page. - 5. Select the "Configure Ansible Job" action. - 6. Click the Schedule Recurring Job button, and using the popup, schedule a - recurring Job. - 7. Navigate to Job Invocations. - - :expectedresults: The scheduled Job appears in the Job Invocation list at the appointed - time - """