From d4c7098b964b0896d360f9c046f80eca40e12a9a Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Wed, 1 May 2024 12:52:47 -0400 Subject: [PATCH 01/13] [6.15.z] [stream] fixes for combined session failures, Errata UI (#14929) --- tests/foreman/ui/test_errata.py | 235 +++++++++++++++++--------------- 1 file changed, 125 insertions(+), 110 deletions(-) diff --git a/tests/foreman/ui/test_errata.py b/tests/foreman/ui/test_errata.py index dadcaf6bef9..becd3e6dcf4 100644 --- a/tests/foreman/ui/test_errata.py +++ b/tests/foreman/ui/test_errata.py @@ -11,7 +11,7 @@ :CaseImportance: High """ -from datetime import datetime +from datetime import datetime, timedelta from broker import Broker from dateutil.parser import parse @@ -209,10 +209,10 @@ def _publish_and_wait(sat, org, cv): @pytest.fixture -def errata_host_ak(module_target_sat, module_org, module_lce): - """New activation key created in module_org and module_lce""" +def errata_host_ak(module_target_sat, module_sca_manifest_org, module_lce): + """New activation key created in module SCA org and module lce""" ak = module_target_sat.api.ActivationKey( - organization=module_org, + organization=module_sca_manifest_org, environment=module_lce, ).create() return ak.read() @@ -220,10 +220,10 @@ def errata_host_ak(module_target_sat, module_org, module_lce): @pytest.fixture def registered_contenthost( + module_sca_manifest_org, module_target_sat, rhel_contenthost, errata_host_ak, - module_org, module_lce, module_cv, request, @@ -260,7 +260,7 @@ def registered_contenthost( custom_repo_info = module_target_sat.cli_factory.setup_org_for_a_custom_repo( { 'url': repo_url, - 'organization-id': module_org.id, + 'organization-id': module_sca_manifest_org.id, 'lifecycle-environment-id': module_lce.id, 'activationkey-id': errata_host_ak.id, 'content-view-id': module_cv.id, @@ -270,17 +270,22 @@ def registered_contenthost( custom_repos.append(custom_repo_info['repository-id']) # Publish new version and promote with all content - cv_publish_promote(module_target_sat, module_org, module_cv, module_lce) + cv_publish_promote(module_target_sat, module_sca_manifest_org, module_cv, module_lce) result = rhel_contenthost.register( activation_keys=errata_host_ak.name, target=module_target_sat, - org=module_org, + org=module_sca_manifest_org, loc=None, ) assert result.status == 0, f'Failed to register host:\n{result.stderr}' - assert rhel_contenthost.subscribed + assert rhel_contenthost.subscribed, ( + f'Failed to subscribe host to content, host: {rhel_contenthost.hostname}' + f' Attempting to subscribe to content-view id: {module_cv.id}' + f' Using activation-key id: {errata_host_ak.id}' + ) for custom_repo_id in custom_repos: + # custom repos setup and successfully sync custom_repo = module_target_sat.api.Repository(id=custom_repo_id).read() assert custom_repo result = custom_repo.sync()['humanized'] @@ -291,23 +296,30 @@ def registered_contenthost( yield rhel_contenthost @request.addfinalizer - # Cleanup for in between parameterized runs + # Cleanup for in-between parameterized sessions def cleanup(): - nonlocal rhel_contenthost, module_cv, custom_repos, custom_products, errata_host_ak + nonlocal rhel_contenthost, module_cv, module_lce, custom_repos, custom_products, errata_host_ak, module_sca_manifest_org rhel_contenthost.unregister() errata_host_ak.delete() + # find any other aks and delete them + other_aks = module_target_sat.api.ActivationKey( + organization=module_sca_manifest_org, + environment=module_lce, + ).search() + for ak in other_aks: + ak.read().delete() # Remove CV from all lifecycle-environments module_target_sat.cli.ContentView.remove_from_environment( { 'id': module_cv.id, - 'organization-id': module_org.id, + 'organization-id': module_sca_manifest_org.id, 'lifecycle-environment-id': module_lce.id, } ) module_target_sat.cli.ContentView.remove_from_environment( { 'id': module_cv.id, - 'organization-id': module_org.id, + 'organization-id': module_sca_manifest_org.id, 'lifecycle-environment': 'Library', } ) @@ -326,9 +338,6 @@ def cleanup(): module_target_sat.api.Repository(id=repo_id).delete() for product_id in custom_products: module_target_sat.api.Product(id=product_id).delete() - # Publish a new CV version with no content - module_cv = module_cv.read() - module_cv.publish() @pytest.mark.e2e @@ -498,7 +507,6 @@ def test_host_content_errata_tab_pagination( module_target_sat, registered_contenthost, module_sca_manifest_org, - errata_host_ak, module_lce, module_cv, ): @@ -724,12 +732,12 @@ def test_host_content_errata_tab_pagination( @pytest.mark.skipif((not settings.robottelo.REPOS_HOSTING_URL), reason='Missing repos_hosting_url') def test_positive_list( module_sca_manifest_org, + errata_host_ak, function_org, function_lce, target_sat, module_lce, module_cv, - module_ak, session, ): """View all errata in an Org @@ -756,7 +764,7 @@ def test_positive_list( 'url': CUSTOM_REPO_URL, 'organization-id': _org_module.id, 'lifecycle-environment-id': module_lce.id, - 'activationkey-id': module_ak.id, + 'activationkey-id': errata_host_ak.id, 'content-view-id': module_cv.id, }, ) @@ -1081,112 +1089,99 @@ def test_positive_content_host_previous_env( @pytest.mark.tier3 +@pytest.mark.rhel_ver_match('8') @pytest.mark.parametrize( - 'module_repos_collection_with_setup', - [ - { - 'distro': 'rhel7', - 'SatelliteToolsRepository': {}, - 'RHELAnsibleEngineRepository': {'cdn': True}, - 'YumRepository': {'url': CUSTOM_REPO_URL}, - } - ], + 'registered_contenthost', + [[CUSTOM_REPO_URL]], indirect=True, ) -def test_positive_content_host_library(session, module_org_with_parameter, vm): - """Check if the applicable errata are available from the content - host's Library +def test_positive_check_errata(session, module_org_with_parameter, registered_contenthost): + """Check if the applicable errata is available from the host page - :id: 4e627410-b7b8-471b-b9b4-a18e77fdd3f8 + :id: a0694930-4bf7-4a97-b275-2be7d5f1b311 - :Setup: - - 1. Make sure multiple environments are present. - 2. Content host's Library environment has additional errata. - - :steps: Go to Content Hosts -> Select content host -> Errata Tab -> Select 'Library'. + :steps: + 1. Go to All hosts + 2. Select the host + 3. Content Tab -> Errata Tab + 4. Check the errata - :expectedresults: The errata from Library are displayed. + :expectedresults: The errata is displayed on the host page Content-Errata tab :parametrized: yes """ + + vm = registered_contenthost hostname = vm.hostname assert vm.execute(f'yum install -y {FAKE_1_CUSTOM_PACKAGE}').status == 0 with session: session.location.select(loc_name=DEFAULT_LOC) - content_host_erratum = session.contenthost.search_errata( - hostname, CUSTOM_REPO_ERRATA_ID, environment='Library Synced Content' - ) - assert content_host_erratum[0]['Id'] == CUSTOM_REPO_ERRATA_ID + read_errata = session.host_new.get_details(hostname, 'Content.Errata') + assert read_errata['Content']['Errata']['table'][0]['Errata'] == CUSTOM_REPO_ERRATA_ID @pytest.mark.tier3 +@pytest.mark.rhel_ver_match('8') @pytest.mark.parametrize( - 'module_repos_collection_with_setup', - [ - { - 'distro': 'rhel7', - 'SatelliteToolsRepository': {}, - 'RHELAnsibleEngineRepository': {'cdn': True}, - 'YumRepository': {'url': settings.repos.yum_9.url}, - } - ], + 'registered_contenthost', + [[CUSTOM_REPO_URL]], indirect=True, ) -def test_positive_content_host_search_type(session, erratatype_vm): - """Search for errata on a content host's errata tab by type. - - :id: 59e5d6e5-2537-4387-a7d3-637cc4b52d0e +def test_positive_errata_search_type(session, module_sca_manifest_org, registered_contenthost): + """Search for errata on a host's page content-errata tab by type. - :Setup: Content Host with applicable errata + :id: f278f0e8-3b64-4dbf-a0c8-b9b289474a76 :customerscenario: true - :steps: Search for errata on content host by type (e.g. 'type = security') - Step 1 Search for "type = security", assert expected amount and IDs found - Step 2 Search for "type = bugfix", assert expected amount and IDs found - Step 3 Search for "type = enhancement", assert expected amount and IDs found + :steps: Search for errata on the host Content-Errata tab by type (e.g. 'type = Security') + 1. Search for "type = Security", assert expected amount and IDs found + 2. Search for "type = Bugfix", assert expected amount and IDs found + 3. Search for "type = Enhancement", assert expected amount and IDs found :BZ: 1653293 """ - + vm = registered_contenthost pkgs = ' '.join(FAKE_9_YUM_OUTDATED_PACKAGES) - assert erratatype_vm.execute(f'yum install -y {pkgs}').status == 0 + assert vm.execute(f'yum install -y {pkgs}').status == 0 with session: session.location.select(loc_name=DEFAULT_LOC) - # Search for RHSA security errata - ch_erratum = session.contenthost.search_errata( - erratatype_vm.hostname, "type = security", environment='Library Synced Content' - ) + # Search for RHSA Security errata + security_erratas = session.host_new.get_errata_by_type( + entity_name=vm.hostname, + type='Security', + )['content']['errata']['table'] # Assert length matches known amount of RHSA errata - assert len(ch_erratum) == FAKE_9_YUM_SECURITY_ERRATUM_COUNT + assert len(security_erratas) == FAKE_9_YUM_SECURITY_ERRATUM_COUNT # Assert IDs are that of RHSA errata - errata_ids = sorted(erratum['Id'] for erratum in ch_erratum) + errata_ids = sorted(erratum['Errata'] for erratum in security_erratas) assert errata_ids == sorted(FAKE_9_YUM_SECURITY_ERRATUM) - # Search for RHBA buxfix errata - ch_erratum = session.contenthost.search_errata( - erratatype_vm.hostname, "type = bugfix", environment='Library Synced Content' - ) + # Search for RHBA Buxfix errata + bugfix_erratas = session.host_new.get_errata_by_type( + entity_name=vm.hostname, + type='Bugfix', + )['content']['errata']['table'] # Assert length matches known amount of RHBA errata - assert len(ch_erratum) == FAKE_10_YUM_BUGFIX_ERRATUM_COUNT + assert len(bugfix_erratas) == FAKE_10_YUM_BUGFIX_ERRATUM_COUNT # Assert IDs are that of RHBA errata - errata_ids = sorted(erratum['Id'] for erratum in ch_erratum) + errata_ids = sorted(erratum['Errata'] for erratum in bugfix_erratas) assert errata_ids == sorted(FAKE_10_YUM_BUGFIX_ERRATUM) - # Search for RHEA enhancement errata - ch_erratum = session.contenthost.search_errata( - erratatype_vm.hostname, "type = enhancement", environment='Library Synced Content' - ) + # Search for RHEA Enhancement errata + enhancement_erratas = session.host_new.get_errata_by_type( + entity_name=vm.hostname, + type='Enhancement', + )['content']['errata']['table'] # Assert length matches known amount of RHEA errata - assert len(ch_erratum) == FAKE_11_YUM_ENHANCEMENT_ERRATUM_COUNT + assert len(enhancement_erratas) == FAKE_11_YUM_ENHANCEMENT_ERRATUM_COUNT # Assert IDs are that of RHEA errata - errata_ids = sorted(erratum['Id'] for erratum in ch_erratum) + errata_ids = sorted(erratum['Errata'] for erratum in enhancement_erratas) assert errata_ids == sorted(FAKE_11_YUM_ENHANCEMENT_ERRATUM) @@ -1297,54 +1292,74 @@ def test_positive_show_count_on_host_pages(session, module_org, registered_conte @pytest.mark.tier3 +@pytest.mark.rhel_ver_match('8') @pytest.mark.parametrize( - 'module_repos_collection_with_setup', - [ - { - 'distro': 'rhel7', - 'SatelliteToolsRepository': {}, - 'RHELAnsibleEngineRepository': {'cdn': True}, - 'YumRepository': {'url': settings.repos.yum_9.url}, - } - ], + 'registered_contenthost', + [[CUSTOM_REPO_URL]], indirect=True, ) -def test_positive_show_count_on_content_host_details_page( - session, module_org_with_parameter, erratatype_vm +def test_positive_check_errata_counts_by_type_on_host_details_page( + session, + module_target_sat, + module_sca_manifest_org, + registered_contenthost, ): - """Errata count on Content host Details page + """Errata count on host page - :id: 388229da-2b0b-41aa-a457-9b5ecbf3df4b + :id: 89676641-2614-4abb-afed-5c37be396fad :Setup: - 1. Errata synced on satellite server. - 2. Some content hosts are present. + 2. Some registered host with errata and packages is present. + 3. Install list of outdated packages (FAKE_YUM_9), to the registered host. - :steps: Go to Hosts -> Content Hosts -> Select Content Host -> Details page. + :steps: + 1. Go to All hosts + 2. Select the host + 3. Content Tab -> Errata Tab + 4. Check the counts of the errata types - :expectedresults: The errata section should be displayed with Security, Bug fix, Enhancement. + :expectedresults: + 1. Packages install succeeds, errata applicability updates automatically. + 2. Correct number of each errata type shown for host. - :BZ: 1484044 """ - vm = erratatype_vm + vm = registered_contenthost hostname = vm.hostname with session: session.location.select(loc_name=DEFAULT_LOC) - content_host_values = session.contenthost.read(hostname, 'details') - for errata_type in ('security', 'bug_fix', 'enhancement'): - assert int(content_host_values['details'][errata_type]) == 0 + # from details: no errata to start + read_errata = session.host_new.get_details(hostname, 'Content.Errata') + assert int(len(read_errata['Content']['Errata']['pagination'])) == 0 pkgs = ' '.join(FAKE_9_YUM_OUTDATED_PACKAGES) + install_timestamp = datetime.utcnow().replace(microsecond=0) - timedelta(seconds=1) assert vm.execute(f'yum install -y {pkgs}').status == 0 - # navigate to content host main page by making a search, to refresh the details page - session.contenthost.search(hostname) - content_host_values = session.contenthost.read(hostname, 'details') - assert int(content_host_values['details']['security']) == FAKE_9_YUM_SECURITY_ERRATUM_COUNT - - for errata_type in ('bug_fix', 'enhancement'): - assert int(content_host_values['details'][errata_type]) == 1 + # applicability task(s) found and succeed + applicability_tasks = module_target_sat.wait_for_tasks( + search_query=( + f'Bulk generate applicability for host {hostname}' + f' and started_at >= "{install_timestamp}"' + ), + search_rate=2, + max_tries=60, + ) + assert len(applicability_tasks) > 0, ( + 'No Errata applicability task(s) found after successful yum install.' + ' Expected at least one task invoked automatically,' + f' for registered host: {hostname}' + ) + for task in applicability_tasks: + assert task.result == 'success' + assert module_target_sat.api.ForemanTask(id=task.id).poll() + + # find newly applicable errata counts by type + session.browser.refresh() + errata_type_counts = session.host_new.get_errata_type_counts(entity_name=hostname) + assert errata_type_counts['Security'] == FAKE_9_YUM_SECURITY_ERRATUM_COUNT + assert errata_type_counts['Bugfix'] == 1 + assert errata_type_counts['Enhancement'] == 1 @pytest.mark.tier3 From 61f64b5ffbf75a51ce4146a89834c215a5a5b98d Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Wed, 1 May 2024 17:38:20 -0400 Subject: [PATCH 02/13] [6.15.z] Errata-UI: Fix test_positive_host_content_library (#14932) --- tests/foreman/ui/test_errata.py | 70 ++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 2 deletions(-) diff --git a/tests/foreman/ui/test_errata.py b/tests/foreman/ui/test_errata.py index becd3e6dcf4..612f92786ae 100644 --- a/tests/foreman/ui/test_errata.py +++ b/tests/foreman/ui/test_errata.py @@ -1088,7 +1088,7 @@ def test_positive_content_host_previous_env( assert content_host_erratum[0]['Id'] == CUSTOM_REPO_ERRATA_ID -@pytest.mark.tier3 +@pytest.mark.tier2 @pytest.mark.rhel_ver_match('8') @pytest.mark.parametrize( 'registered_contenthost', @@ -1098,7 +1098,7 @@ def test_positive_content_host_previous_env( def test_positive_check_errata(session, module_org_with_parameter, registered_contenthost): """Check if the applicable errata is available from the host page - :id: a0694930-4bf7-4a97-b275-2be7d5f1b311 + :id: 81f3c5bf-5317-40d6-ab3a-2b1a2c5fcbdd :steps: 1. Go to All hosts @@ -1120,6 +1120,72 @@ def test_positive_check_errata(session, module_org_with_parameter, registered_co assert read_errata['Content']['Errata']['table'][0]['Errata'] == CUSTOM_REPO_ERRATA_ID +@pytest.mark.tier3 +@pytest.mark.rhel_ver_match('[8, 9]') +def test_positive_host_content_library( + registered_contenthost, + function_lce, + module_lce, + session, +): + """Check if the applicable errata are available from the content host's Library. + View errata table from within All Hosts, and legacy Contenthosts pages. + + :id: a0694930-4bf7-4a97-b275-2be7d5f1b311 + + :Setup: + 1. Multiple environments are present, we will use 'Library'. + 2. A registered host's Library environment has some additional errata. + + :steps: + 1. Install the outdated package to registered host, making an errata applicable. + 2. Go to new All Hosts -> Select the host -> Content -> Errata Tab. + 3. Go to Legacy Content Hosts -> Select the host -> Errata Tab -> 'Library' env. + 4. Search for the errata by id. Then, check the entire table without filtering. + + :expectedresults: The expected errata id present in Library is displayed. + Only a single errata is present, the tables match between the two pages. + + :parametrized: yes + """ + client = registered_contenthost + hostname = client.hostname + + assert client.applicable_errata_count == 0 + assert client.execute(f'yum install -y {FAKE_1_CUSTOM_PACKAGE}').status == 0 + assert client.applicable_errata_count == 1 + assert client.applicable_package_count == 1 + + with session: + session.location.select(loc_name=DEFAULT_LOC) + # check new host > host > content > errata tab: + host_tab_search = session.host_new.get_errata_table( + entity_name=hostname, + search=f'errata_id="{CUSTOM_REPO_ERRATA_ID}"', + ) + # found desired errata_id by search + assert len(host_tab_search) == 1 + assert host_tab_search[0]['Errata'] == CUSTOM_REPO_ERRATA_ID + # no filters passed, checking all errata present + host_tab_erratum = session.host_new.get_errata_table(hostname) + # only the expected errata_id is found + assert len(host_tab_erratum) == 1 + assert host_tab_erratum[0]['Errata'] == CUSTOM_REPO_ERRATA_ID + # check legacy chost > chost > errata tab -- search: + single_chost_search = session.contenthost.search_errata( + hostname, CUSTOM_REPO_ERRATA_ID, environment='Library Synced Content' + ) + # found desired errata_id by search + assert len(single_chost_search) == 1 + assert single_chost_search[0]['Id'] == CUSTOM_REPO_ERRATA_ID + # display all entries in chost table, only the expected one is present + all_chost_erratum = session.contenthost.search_errata( + hostname, errata_id=' ', environment='Library Synced Content' + ) + assert len(all_chost_erratum) == 1 + assert all_chost_erratum[0]['Id'] == CUSTOM_REPO_ERRATA_ID + + @pytest.mark.tier3 @pytest.mark.rhel_ver_match('8') @pytest.mark.parametrize( From de81a327cf24108ea225548667568651ae2920d4 Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Thu, 2 May 2024 05:11:46 -0400 Subject: [PATCH 03/13] [6.15.z] Add test coverage for BZ#2250397 (#14934) --- tests/foreman/cli/test_registration.py | 55 +++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/tests/foreman/cli/test_registration.py b/tests/foreman/cli/test_registration.py index 34f3fb7f7b6..0d2c6488314 100644 --- a/tests/foreman/cli/test_registration.py +++ b/tests/foreman/cli/test_registration.py @@ -11,9 +11,11 @@ :Team: Rocket """ +import json import re +from tempfile import mkstemp -from fauxfactory import gen_string +from fauxfactory import gen_mac, gen_string import pytest from robottelo.config import settings @@ -224,3 +226,54 @@ def test_negative_global_registration_without_ak(module_target_sat): 'Failed to generate registration command:\n Missing activation key!' in context.value.message ) + + +@pytest.mark.rhel_ver_match('8') +def test_positive_custom_facts_for_host_registration( + module_sca_manifest_org, + module_location, + module_target_sat, + rhel_contenthost, + module_activation_key, +): + """Attempt to register a host and check all the interfaces are created from the custom facts + + :id: db73c146-4557-4bf4-a8e2-950ecba31620 + + :steps: + 1. Register the host. + 2. Check the host is registered and all the interfaces are created successfully. + + :expectedresults: Host registered successfully with all interfaces created from the custom facts. + + :BZ: 2250397 + + :customerscenario: true + """ + interfaces = [ + {'name': gen_string('alphanumeric')}, + {'name': 'enp98s0f0', 'mac': gen_mac(multicast=False)}, + {'name': 'Datos', 'vlan_id': gen_string('numeric', 4)}, + {'name': 'bondBk', 'vlan_id': gen_string('numeric', 4)}, + ] + facts = { + f'net.interface.{interfaces[0]["name"]}.mac_address': gen_mac(), + f'net.interface.{interfaces[1]["name"]}.mac_address': interfaces[1]["mac"], + f'net.interface.{interfaces[2]["name"]}.{interfaces[2]["vlan_id"]}.mac_address': gen_mac(), + f'net.interface.{interfaces[3]["name"]}.{interfaces[3]["vlan_id"]}.mac_address': gen_mac(), + } + _, facts_file = mkstemp(suffix='.facts') + with open(facts_file, 'w') as f: + json.dump(facts, f, indent=4) + rhel_contenthost.put(facts_file, '/etc/rhsm/facts/') + result = rhel_contenthost.register( + module_sca_manifest_org, module_location, [module_activation_key.name], module_target_sat + ) + assert result.status == 0, f'Failed to register host: {result.stderr}' + host_info = module_target_sat.cli.Host.info( + {'name': rhel_contenthost.hostname}, output_format='json' + ) + assert len(host_info['network-interfaces']) == len(interfaces) + 1 # facts + default interface + for interface in interfaces: + for interface_name in interface.values(): + assert interface_name in str(host_info['network-interfaces']) From 6245bb5085ec92f32d3d326281145682275675f0 Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Thu, 2 May 2024 08:16:28 -0400 Subject: [PATCH 04/13] [6.15.z] CC Automation/Comp Eval coverage - promote CCV with specific registry_name (#14927) CC Automation/Comp Eval coverage - promote CCV with specific registry_name (#14451) * CC Automation/Comp Eval coverage * change to non-sca org * CC Automation/Comp Eval coverage * change to non-sca org * Fix formatting issues * Adjust assert statement, and fix docstring issue * Adjust assert statement, and fix docstring issue (cherry picked from commit 3f1b9e419c906275b739a03019c094960afed68f) Co-authored-by: Samuel Bible --- tests/foreman/api/test_contentview.py | 58 +++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/tests/foreman/api/test_contentview.py b/tests/foreman/api/test_contentview.py index 2cbeaf50860..b8b9024b3f2 100644 --- a/tests/foreman/api/test_contentview.py +++ b/tests/foreman/api/test_contentview.py @@ -22,6 +22,7 @@ from robottelo.constants import ( CONTAINER_REGISTRY_HUB, CUSTOM_RPM_SHA_512_FEED_COUNT, + DEFAULT_ARCHITECTURE, FILTER_ERRATA_TYPE, PERMISSIONS, PRDS, @@ -279,6 +280,63 @@ def test_positive_add_sha512_rpm(self, content_view, module_org, module_target_s content_view_version.errata_counts['total'] == CUSTOM_RPM_SHA_512_FEED_COUNT['errata'] ) + @pytest.mark.tier2 + def test_ccv_promote_registry_name_change(self, module_target_sat, module_sca_manifest_org): + """Testing CCV promotion scenarios where the registry_name has been changed to some + specific value. + + :id: 41641d4a-d144-4833-869a-284624df2410 + + :steps: + + 1) Sync a RH Repo + 2) Create a CV, add the repo and publish it + 3) Create a CCV and add the CV version to it, then publish it + 4) Create LCEs with the specific value for registry_name + 5) Promote the CCV to both LCEs + + :expectedresults: CCV can be promoted to both LCEs without issue. + + :CaseImportance: High + + :customerscenario: true + + :BZ: 2153523 + """ + rh_repo_id = module_target_sat.api_factory.enable_rhrepo_and_fetchid( + basearch=DEFAULT_ARCHITECTURE, + org_id=module_sca_manifest_org.id, + product=REPOS['kickstart']['rhel8_aps']['product'], + repo=REPOS['kickstart']['rhel8_aps']['name'], + reposet=REPOS['kickstart']['rhel8_aps']['reposet'], + releasever=REPOS['kickstart']['rhel8_aps']['version'], + ) + repo = module_target_sat.api.Repository(id=rh_repo_id).read() + repo.sync(timeout=600) + cv = module_target_sat.api.ContentView(organization=module_sca_manifest_org).create() + cv = module_target_sat.api.ContentView(id=cv.id, repository=[repo]).update(["repository"]) + cv.publish() + cv = cv.read() + composite_cv = module_target_sat.api.ContentView( + organization=module_sca_manifest_org, composite=True + ).create() + composite_cv.component = [cv.version[0]] + composite_cv = composite_cv.update(['component']) + composite_cv.publish() + composite_cv = composite_cv.read() + # Create LCEs with the specific registry value + lce1 = module_target_sat.api.LifecycleEnvironment( + organization=module_sca_manifest_org, + registry_name_pattern='<%= repository.name %>', + ).create() + lce2 = module_target_sat.api.LifecycleEnvironment( + organization=module_sca_manifest_org, + registry_name_pattern='<%= lifecycle_environment.label %>/<%= repository.name %>', + ).create() + version = composite_cv.version[0].read() + assert 'success' in version.promote(data={'environment_ids': lce1.id})['result'] + assert 'success' in version.promote(data={'environment_ids': lce2.id})['result'] + class TestContentViewCreate: """Create tests for content views.""" From cbd86fe3389845821aee2742780aebe3b526dc6b Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Fri, 3 May 2024 12:04:21 -0400 Subject: [PATCH 05/13] [6.15.z] [Stream Fix] Remove escaped quotation mark from valid_name list (#14950) --- robottelo/utils/datafactory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/robottelo/utils/datafactory.py b/robottelo/utils/datafactory.py index c5ccc38ba14..9d9cf134b85 100644 --- a/robottelo/utils/datafactory.py +++ b/robottelo/utils/datafactory.py @@ -389,7 +389,7 @@ def valid_names_list(): f"νέος χρήστης-{gen_string('utf8', 2)}", f"foo@!#$^&*( ) {gen_string('utf8')}", f"{gen_string('utf8')}", - f"bar+{{}}|\"?hi {gen_string('utf8')}", + f"bar+{{}}|?hi {gen_string('utf8')}", f" {gen_string('utf8')}", f"{gen_string('utf8')} ", ] From c6e93528ffca2aed681c89362afb5a6e3b22a895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Gajdu=C5=A1ek?= Date: Fri, 3 May 2024 18:21:43 +0200 Subject: [PATCH 06/13] [6.15.z] Lint: Black -> Ruff formatter (#14896) (#14946) Lint: Black -> Ruff formatter (#14896) --- .pre-commit-config.yaml | 7 +-- conftest.py | 1 + docs/conf.py | 1 + pyproject.toml | 24 +++------- pytest_fixtures/component/virtwho_config.py | 6 +-- pytest_fixtures/core/contenthosts.py | 1 + pytest_fixtures/core/xdist.py | 5 +- pytest_plugins/capsule_n-minus.py | 1 - pytest_plugins/requirements/req_updater.py | 1 - .../requirements/update_requirements.py | 1 + pytest_plugins/sanity_plugin.py | 2 +- robottelo/cli/acs.py | 1 + robottelo/cli/activationkey.py | 1 + robottelo/cli/admin.py | 1 + robottelo/cli/ansible.py | 1 + robottelo/cli/architecture.py | 1 + robottelo/cli/arfreport.py | 1 + robottelo/cli/auth.py | 1 + robottelo/cli/base.py | 1 + robottelo/cli/bootdisk.py | 1 + robottelo/cli/capsule.py | 1 + robottelo/cli/computeprofile.py | 1 + robottelo/cli/computeresource.py | 1 + robottelo/cli/content_credentials.py | 1 + robottelo/cli/content_export.py | 1 + robottelo/cli/content_import.py | 1 + robottelo/cli/contentview.py | 1 + robottelo/cli/defaults.py | 1 + robottelo/cli/discoveredhost.py | 1 + robottelo/cli/discoveryrule.py | 1 + robottelo/cli/docker.py | 1 + robottelo/cli/domain.py | 1 + robottelo/cli/environment.py | 1 + robottelo/cli/erratum.py | 1 + robottelo/cli/fact.py | 1 + robottelo/cli/file.py | 1 + robottelo/cli/filter.py | 1 + robottelo/cli/globalparam.py | 1 + robottelo/cli/gpgkey.py | 1 + robottelo/cli/hammer.py | 1 + robottelo/cli/host.py | 1 + robottelo/cli/host_registration.py | 1 + robottelo/cli/hostcollection.py | 1 + robottelo/cli/hostgroup.py | 1 + robottelo/cli/http_proxy.py | 1 + robottelo/cli/job_invocation.py | 1 + robottelo/cli/job_template.py | 1 + robottelo/cli/ldapauthsource.py | 1 + robottelo/cli/lifecycleenvironment.py | 1 + robottelo/cli/location.py | 1 + robottelo/cli/medium.py | 1 + robottelo/cli/model.py | 1 + robottelo/cli/module_stream.py | 1 + robottelo/cli/operatingsys.py | 1 + robottelo/cli/org.py | 1 + robottelo/cli/ostreebranch.py | 1 + robottelo/cli/package.py | 1 + robottelo/cli/partitiontable.py | 1 + robottelo/cli/product.py | 1 + robottelo/cli/proxy.py | 1 + robottelo/cli/puppet.py | 1 + robottelo/cli/realm.py | 1 + robottelo/cli/recurring_logic.py | 1 + robottelo/cli/report.py | 1 + robottelo/cli/report_template.py | 1 + robottelo/cli/repository.py | 1 + robottelo/cli/repository_set.py | 1 + robottelo/cli/rex_feature.py | 1 + robottelo/cli/role.py | 1 + robottelo/cli/scap_policy.py | 1 + robottelo/cli/scap_tailoring_files.py | 1 + robottelo/cli/scapcontent.py | 1 + robottelo/cli/scparams.py | 1 + robottelo/cli/settings.py | 1 + robottelo/cli/simple_content_access.py | 1 + robottelo/cli/sm_advanced.py | 1 + robottelo/cli/sm_advanced_by_tag.py | 1 + robottelo/cli/sm_backup.py | 1 + robottelo/cli/sm_health.py | 1 + robottelo/cli/sm_maintenance_mode.py | 1 + robottelo/cli/sm_packages.py | 1 + robottelo/cli/sm_restore.py | 1 + robottelo/cli/sm_service.py | 1 + robottelo/cli/sm_upgrade.py | 1 + robottelo/cli/srpm.py | 1 + robottelo/cli/subnet.py | 1 + robottelo/cli/subscription.py | 1 + robottelo/cli/syncplan.py | 1 + robottelo/cli/task.py | 1 + robottelo/cli/template.py | 1 + robottelo/cli/template_input.py | 1 + robottelo/cli/template_sync.py | 1 + robottelo/cli/user.py | 1 + robottelo/cli/usergroup.py | 1 + robottelo/cli/virt_who_config.py | 1 + robottelo/cli/webhook.py | 2 +- robottelo/constants/__init__.py | 2 + robottelo/content_info.py | 1 + robottelo/host_helpers/api_factory.py | 1 + robottelo/host_helpers/cli_factory.py | 1 + robottelo/host_helpers/contenthost_mixins.py | 1 + robottelo/host_helpers/repository_mixins.py | 2 +- robottelo/host_helpers/satellite_mixins.py | 2 +- robottelo/host_helpers/ui_factory.py | 1 + robottelo/hosts.py | 7 +-- robottelo/ssh.py | 1 + robottelo/utils/datafactory.py | 1 + robottelo/utils/decorators/__init__.py | 1 + robottelo/utils/decorators/func_locker.py | 2 +- .../decorators/func_shared/file_storage.py | 1 - .../decorators/func_shared/redis_storage.py | 1 - .../utils/decorators/func_shared/shared.py | 9 +--- robottelo/utils/manifest.py | 6 +-- robottelo/utils/ohsnap.py | 1 + robottelo/utils/shared_resource.py | 1 + robottelo/utils/ssh.py | 1 + robottelo/utils/vault.py | 1 + robottelo/utils/virtwho.py | 1 + scripts/config_helpers.py | 1 + scripts/graph_entities.py | 1 + scripts/hammer_command_tree.py | 1 + scripts/token_editor.py | 3 +- scripts/tokenize_customer_scenario.py | 1 + scripts/validate_config.py | 1 + tests/foreman/api/test_acs.py | 1 + tests/foreman/api/test_activationkey.py | 1 + tests/foreman/api/test_ansible.py | 1 + tests/foreman/api/test_architecture.py | 1 + tests/foreman/api/test_audit.py | 1 + tests/foreman/api/test_bookmarks.py | 1 + tests/foreman/api/test_capsule.py | 1 + tests/foreman/api/test_classparameters.py | 1 + tests/foreman/api/test_computeprofile.py | 1 + .../api/test_computeresource_azurerm.py | 1 + tests/foreman/api/test_computeresource_gce.py | 1 + .../api/test_computeresource_libvirt.py | 1 + tests/foreman/api/test_contentcredentials.py | 1 + tests/foreman/api/test_contentview.py | 1 + tests/foreman/api/test_contentviewfilter.py | 1 + tests/foreman/api/test_contentviewversion.py | 1 + tests/foreman/api/test_convert2rhel.py | 1 + tests/foreman/api/test_discoveredhost.py | 1 + tests/foreman/api/test_discoveryrule.py | 1 + tests/foreman/api/test_docker.py | 1 + tests/foreman/api/test_environment.py | 1 + tests/foreman/api/test_errata.py | 47 ++++++++++--------- tests/foreman/api/test_filter.py | 1 + tests/foreman/api/test_foremantask.py | 1 + tests/foreman/api/test_host.py | 1 + tests/foreman/api/test_hostcollection.py | 1 + tests/foreman/api/test_hostgroup.py | 1 + tests/foreman/api/test_http_proxy.py | 1 + tests/foreman/api/test_ldapauthsource.py | 1 + .../foreman/api/test_lifecycleenvironment.py | 1 + tests/foreman/api/test_location.py | 1 + tests/foreman/api/test_media.py | 3 +- tests/foreman/api/test_multiple_paths.py | 1 + tests/foreman/api/test_notifications.py | 5 +- tests/foreman/api/test_operatingsystem.py | 1 + tests/foreman/api/test_organization.py | 1 + .../foreman/api/test_oscap_tailoringfiles.py | 1 + tests/foreman/api/test_oscappolicy.py | 1 + tests/foreman/api/test_parameters.py | 1 + tests/foreman/api/test_partitiontable.py | 1 + tests/foreman/api/test_permission.py | 1 + tests/foreman/api/test_ping.py | 1 + tests/foreman/api/test_product.py | 1 + tests/foreman/api/test_provisioning.py | 1 + tests/foreman/api/test_provisioning_puppet.py | 1 + .../foreman/api/test_provisioningtemplate.py | 1 + tests/foreman/api/test_registration.py | 1 + tests/foreman/api/test_remoteexecution.py | 1 + tests/foreman/api/test_reporttemplates.py | 1 + tests/foreman/api/test_repositories.py | 1 + tests/foreman/api/test_repository.py | 3 +- tests/foreman/api/test_repository_set.py | 1 + tests/foreman/api/test_rhc.py | 1 + tests/foreman/api/test_rhcloud_inventory.py | 1 + tests/foreman/api/test_rhsm.py | 1 + tests/foreman/api/test_role.py | 3 +- tests/foreman/api/test_settings.py | 1 + tests/foreman/api/test_subnet.py | 1 + tests/foreman/api/test_subscription.py | 1 + tests/foreman/api/test_syncplan.py | 1 + .../foreman/api/test_template_combination.py | 1 + tests/foreman/api/test_templatesync.py | 1 + tests/foreman/api/test_user.py | 3 +- tests/foreman/api/test_usergroup.py | 1 + tests/foreman/api/test_webhook.py | 1 + tests/foreman/cli/test_abrt.py | 1 + tests/foreman/cli/test_acs.py | 1 + tests/foreman/cli/test_activationkey.py | 1 + tests/foreman/cli/test_ansible.py | 1 + tests/foreman/cli/test_architecture.py | 1 + tests/foreman/cli/test_auth.py | 5 +- tests/foreman/cli/test_bootdisk.py | 1 + tests/foreman/cli/test_bootstrap_script.py | 1 + tests/foreman/cli/test_capsule.py | 1 + tests/foreman/cli/test_capsulecontent.py | 1 + tests/foreman/cli/test_classparameters.py | 1 + .../cli/test_computeresource_azurerm.py | 11 +++-- tests/foreman/cli/test_computeresource_ec2.py | 1 + .../cli/test_computeresource_libvirt.py | 1 + tests/foreman/cli/test_computeresource_osp.py | 1 + .../foreman/cli/test_computeresource_rhev.py | 1 + .../cli/test_computeresource_vmware.py | 1 + .../foreman/cli/test_container_management.py | 1 + tests/foreman/cli/test_contentaccess.py | 1 + tests/foreman/cli/test_contentcredentials.py | 1 + tests/foreman/cli/test_contentview.py | 1 + tests/foreman/cli/test_contentviewfilter.py | 1 + tests/foreman/cli/test_discoveredhost.py | 1 + tests/foreman/cli/test_discoveryrule.py | 1 + tests/foreman/cli/test_docker.py | 1 + tests/foreman/cli/test_domain.py | 1 + tests/foreman/cli/test_environment.py | 1 + tests/foreman/cli/test_errata.py | 1 + tests/foreman/cli/test_fact.py | 1 + tests/foreman/cli/test_filter.py | 1 + tests/foreman/cli/test_foremantask.py | 1 + tests/foreman/cli/test_globalparam.py | 1 + tests/foreman/cli/test_hammer.py | 1 + tests/foreman/cli/test_host.py | 1 + tests/foreman/cli/test_hostcollection.py | 1 + tests/foreman/cli/test_hostgroup.py | 1 + tests/foreman/cli/test_http_proxy.py | 1 + tests/foreman/cli/test_installer.py | 1 + tests/foreman/cli/test_jobtemplate.py | 1 + tests/foreman/cli/test_ldapauthsource.py | 3 +- tests/foreman/cli/test_leapp_client.py | 1 + .../foreman/cli/test_lifecycleenvironment.py | 1 + tests/foreman/cli/test_location.py | 1 + tests/foreman/cli/test_logging.py | 3 +- tests/foreman/cli/test_medium.py | 1 + tests/foreman/cli/test_model.py | 3 +- tests/foreman/cli/test_operatingsystem.py | 1 + tests/foreman/cli/test_organization.py | 1 + tests/foreman/cli/test_oscap.py | 1 + .../foreman/cli/test_oscap_tailoringfiles.py | 2 +- tests/foreman/cli/test_ostreebranch.py | 1 + tests/foreman/cli/test_partitiontable.py | 1 + tests/foreman/cli/test_ping.py | 1 + tests/foreman/cli/test_product.py | 1 + tests/foreman/cli/test_provisioning.py | 1 + .../foreman/cli/test_provisioningtemplate.py | 1 + tests/foreman/cli/test_puppetclass.py | 1 + tests/foreman/cli/test_realm.py | 1 + tests/foreman/cli/test_registration.py | 1 + tests/foreman/cli/test_remoteexecution.py | 1 + tests/foreman/cli/test_report.py | 1 + tests/foreman/cli/test_reporttemplates.py | 1 + tests/foreman/cli/test_repositories.py | 1 + tests/foreman/cli/test_repository.py | 1 + tests/foreman/cli/test_repository_set.py | 1 + tests/foreman/cli/test_rhcloud_inventory.py | 1 + tests/foreman/cli/test_role.py | 1 + tests/foreman/cli/test_satellitesync.py | 1 + tests/foreman/cli/test_settings.py | 1 + tests/foreman/cli/test_sso.py | 1 + tests/foreman/cli/test_subnet.py | 1 + tests/foreman/cli/test_subscription.py | 1 + tests/foreman/cli/test_syncplan.py | 1 + tests/foreman/cli/test_templatesync.py | 1 + tests/foreman/cli/test_user.py | 1 + tests/foreman/cli/test_usergroup.py | 1 + .../cli/test_vm_install_products_package.py | 1 + tests/foreman/cli/test_webhook.py | 1 + tests/foreman/destructive/test_ansible.py | 1 + tests/foreman/destructive/test_auth.py | 1 + tests/foreman/destructive/test_capsule.py | 1 + .../destructive/test_capsule_loadbalancer.py | 1 + .../destructive/test_capsulecontent.py | 1 + tests/foreman/destructive/test_clone.py | 1 + tests/foreman/destructive/test_contenthost.py | 1 + tests/foreman/destructive/test_contentview.py | 1 + .../destructive/test_discoveredhost.py | 1 + .../foreman/destructive/test_foreman_rake.py | 1 + .../destructive/test_foreman_service.py | 1 + tests/foreman/destructive/test_host.py | 1 + tests/foreman/destructive/test_infoblox.py | 1 + tests/foreman/destructive/test_installer.py | 1 + .../destructive/test_katello_certs_check.py | 1 + .../destructive/test_ldap_authentication.py | 10 ++-- .../destructive/test_ldapauthsource.py | 1 + .../destructive/test_leapp_satellite.py | 1 + tests/foreman/destructive/test_packages.py | 1 + tests/foreman/destructive/test_ping.py | 1 + .../foreman/destructive/test_puppetplugin.py | 1 + tests/foreman/destructive/test_realm.py | 1 + .../foreman/destructive/test_registration.py | 1 + .../destructive/test_remoteexecution.py | 1 + tests/foreman/destructive/test_rename.py | 1 + tests/foreman/destructive/test_repository.py | 1 + tests/foreman/endtoend/test_api_endtoend.py | 1 + tests/foreman/endtoend/test_cli_endtoend.py | 1 + tests/foreman/installer/test_infoblox.py | 1 + tests/foreman/installer/test_installer.py | 1 + tests/foreman/longrun/test_inc_updates.py | 1 + tests/foreman/longrun/test_oscap.py | 1 + tests/foreman/longrun/test_remoteexecution.py | 1 + tests/foreman/maintain/test_advanced.py | 1 + tests/foreman/maintain/test_backup_restore.py | 17 +++---- tests/foreman/maintain/test_health.py | 1 + .../foreman/maintain/test_maintenance_mode.py | 1 + tests/foreman/maintain/test_offload_DB.py | 1 + tests/foreman/maintain/test_packages.py | 1 + tests/foreman/maintain/test_service.py | 1 + tests/foreman/maintain/test_upgrade.py | 1 + tests/foreman/sanity/test_bvt.py | 1 + tests/foreman/sys/test_dynflow.py | 1 + tests/foreman/sys/test_fam.py | 1 + tests/foreman/sys/test_katello_certs_check.py | 1 + tests/foreman/sys/test_pulp3_filesystem.py | 1 + tests/foreman/ui/test_acs.py | 1 + tests/foreman/ui/test_activationkey.py | 1 + tests/foreman/ui/test_ansible.py | 3 +- tests/foreman/ui/test_architecture.py | 1 + tests/foreman/ui/test_audit.py | 1 + tests/foreman/ui/test_bookmarks.py | 1 + tests/foreman/ui/test_branding.py | 1 + tests/foreman/ui/test_capsulecontent.py | 1 + tests/foreman/ui/test_computeprofiles.py | 13 ++--- tests/foreman/ui/test_computeresource.py | 2 +- .../ui/test_computeresource_azurerm.py | 1 + tests/foreman/ui/test_computeresource_ec2.py | 1 + tests/foreman/ui/test_computeresource_gce.py | 1 + .../ui/test_computeresource_libvirt.py | 1 + .../foreman/ui/test_computeresource_vmware.py | 1 + tests/foreman/ui/test_config_group.py | 1 + tests/foreman/ui/test_containerimagetag.py | 1 + tests/foreman/ui/test_contentcredentials.py | 1 + tests/foreman/ui/test_contenthost.py | 7 +-- tests/foreman/ui/test_contentview.py | 1 + tests/foreman/ui/test_contentview_old.py | 1 + tests/foreman/ui/test_dashboard.py | 11 +++-- tests/foreman/ui/test_discoveredhost.py | 1 + tests/foreman/ui/test_discoveryrule.py | 1 + tests/foreman/ui/test_domain.py | 1 + tests/foreman/ui/test_eol_banner.py | 1 + tests/foreman/ui/test_errata.py | 32 ++++++++----- tests/foreman/ui/test_hardwaremodel.py | 1 + tests/foreman/ui/test_host.py | 1 + tests/foreman/ui/test_hostcollection.py | 1 + tests/foreman/ui/test_hostgroup.py | 1 + tests/foreman/ui/test_http_proxy.py | 1 + tests/foreman/ui/test_jobtemplate.py | 1 + tests/foreman/ui/test_ldap_authentication.py | 41 ++++++++++------ tests/foreman/ui/test_lifecycleenvironment.py | 1 + tests/foreman/ui/test_location.py | 1 + tests/foreman/ui/test_media.py | 1 + tests/foreman/ui/test_modulestreams.py | 1 + tests/foreman/ui/test_operatingsystem.py | 1 + tests/foreman/ui/test_organization.py | 1 + tests/foreman/ui/test_oscapcontent.py | 1 + tests/foreman/ui/test_oscappolicy.py | 1 + tests/foreman/ui/test_oscaptailoringfile.py | 1 + tests/foreman/ui/test_package.py | 1 + tests/foreman/ui/test_partitiontable.py | 1 + tests/foreman/ui/test_product.py | 1 + tests/foreman/ui/test_provisioningtemplate.py | 1 + tests/foreman/ui/test_puppetclass.py | 1 + tests/foreman/ui/test_puppetenvironment.py | 1 + tests/foreman/ui/test_registration.py | 2 +- tests/foreman/ui/test_remoteexecution.py | 1 + tests/foreman/ui/test_reporttemplates.py | 1 + tests/foreman/ui/test_repositories.py | 1 + tests/foreman/ui/test_repository.py | 1 + tests/foreman/ui/test_rhc.py | 1 + tests/foreman/ui/test_rhcloud_insights.py | 1 + tests/foreman/ui/test_rhcloud_inventory.py | 1 + tests/foreman/ui/test_role.py | 1 + tests/foreman/ui/test_search.py | 1 + tests/foreman/ui/test_settings.py | 1 + tests/foreman/ui/test_smartclassparameter.py | 1 + tests/foreman/ui/test_subnet.py | 1 + tests/foreman/ui/test_subscription.py | 1 + tests/foreman/ui/test_sync.py | 1 + tests/foreman/ui/test_syncplan.py | 1 + tests/foreman/ui/test_templatesync.py | 1 + tests/foreman/ui/test_user.py | 1 + tests/foreman/ui/test_usergroup.py | 1 + tests/foreman/ui/test_webhook.py | 1 + tests/foreman/virtwho/api/test_esx.py | 5 +- tests/foreman/virtwho/api/test_esx_sca.py | 5 +- tests/foreman/virtwho/api/test_hyperv.py | 1 + tests/foreman/virtwho/api/test_hyperv_sca.py | 1 + tests/foreman/virtwho/api/test_kubevirt.py | 1 + .../foreman/virtwho/api/test_kubevirt_sca.py | 1 + tests/foreman/virtwho/api/test_libvirt.py | 1 + tests/foreman/virtwho/api/test_libvirt_sca.py | 1 + tests/foreman/virtwho/api/test_nutanix.py | 1 + tests/foreman/virtwho/api/test_nutanix_sca.py | 1 + tests/foreman/virtwho/cli/test_esx.py | 5 +- tests/foreman/virtwho/cli/test_esx_sca.py | 5 +- tests/foreman/virtwho/cli/test_hyperv.py | 1 + tests/foreman/virtwho/cli/test_hyperv_sca.py | 1 + tests/foreman/virtwho/cli/test_kubevirt.py | 1 + .../foreman/virtwho/cli/test_kubevirt_sca.py | 1 + tests/foreman/virtwho/cli/test_libvirt.py | 1 + tests/foreman/virtwho/cli/test_libvirt_sca.py | 1 + tests/foreman/virtwho/cli/test_nutanix.py | 1 + tests/foreman/virtwho/cli/test_nutanix_sca.py | 1 + tests/foreman/virtwho/ui/test_esx.py | 5 +- tests/foreman/virtwho/ui/test_esx_sca.py | 5 +- tests/foreman/virtwho/ui/test_hyperv.py | 1 + tests/foreman/virtwho/ui/test_hyperv_sca.py | 1 + tests/foreman/virtwho/ui/test_kubevirt.py | 1 + tests/foreman/virtwho/ui/test_kubevirt_sca.py | 1 + tests/foreman/virtwho/ui/test_libvirt.py | 1 + tests/foreman/virtwho/ui/test_libvirt_sca.py | 1 + tests/foreman/virtwho/ui/test_nutanix.py | 1 + tests/foreman/virtwho/ui/test_nutanix_sca.py | 1 + tests/robottelo/test_datafactory.py | 1 + tests/robottelo/test_decorators.py | 1 + tests/robottelo/test_dependencies.py | 1 + tests/robottelo/test_func_locker.py | 40 +++++++++------- tests/robottelo/test_hammer.py | 1 + tests/robottelo/test_helpers.py | 1 + tests/robottelo/test_issue_handlers.py | 7 ++- tests/robottelo/test_ssh.py | 1 + tests/upgrades/conftest.py | 1 + tests/upgrades/test_activation_key.py | 1 + tests/upgrades/test_bookmarks.py | 1 + tests/upgrades/test_capsule.py | 1 + tests/upgrades/test_classparameter.py | 1 + tests/upgrades/test_client.py | 1 + tests/upgrades/test_contentview.py | 1 + tests/upgrades/test_discovery.py | 1 + tests/upgrades/test_errata.py | 1 + tests/upgrades/test_host.py | 1 + tests/upgrades/test_hostcontent.py | 1 + tests/upgrades/test_hostgroup.py | 1 + tests/upgrades/test_performance_tuning.py | 1 + tests/upgrades/test_provisioningtemplate.py | 1 + tests/upgrades/test_puppet.py | 1 + tests/upgrades/test_remoteexecution.py | 1 + tests/upgrades/test_repository.py | 1 + tests/upgrades/test_role.py | 1 + tests/upgrades/test_satellite_maintain.py | 1 + tests/upgrades/test_satellitesync.py | 1 + tests/upgrades/test_subnet.py | 1 + tests/upgrades/test_subscription.py | 1 + tests/upgrades/test_syncplan.py | 1 + tests/upgrades/test_user.py | 1 + tests/upgrades/test_usergroup.py | 1 + tests/upgrades/test_virtwho.py | 3 +- 446 files changed, 603 insertions(+), 186 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c93c0b50203..dd6543a0af9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,15 +11,12 @@ repos: exclude: tests/foreman/data/ - id: check-yaml - id: debug-statements - - repo: https://github.com/psf/black - rev: 22.10.0 - hooks: - - id: black - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.3.0 + rev: v0.4.1 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] + - id: ruff-format - repo: local hooks: - id: fix-uuids diff --git a/conftest.py b/conftest.py index 7645728a06c..f50f81e2975 100644 --- a/conftest.py +++ b/conftest.py @@ -1,4 +1,5 @@ """Global Configurations for py.test runner""" + import pytest pytest_plugins = [ diff --git a/docs/conf.py b/docs/conf.py index b143f7ac6fe..02ef4d4298a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -4,6 +4,7 @@ http://sphinx-doc.org/config.html """ + import builtins import os import sys diff --git a/pyproject.toml b/pyproject.toml index 71e77065d06..ff201b018ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,22 +1,12 @@ -[tool.black] -line-length = 100 -skip-string-normalization = true -include = '\.pyi?$' -exclude = ''' -/( - \.git - | \.hg - | \.mypy_cache - | \.venv - | _build - | buck-out - | build - | dist -)/ -''' - [tool.ruff] target-version = "py311" +# Allow lines to be as long as 100. +line-length = 100 +exclude = [".git", ".hg", ".mypy_cache", ".venv", "_build", "buck-out", "build", "dist"] + +[tool.ruff.format] +# Preserve quotes +quote-style = "preserve" # TODO: change to "single" when flake8-quotes is enabled [tool.ruff.lint] fixable = ["ALL"] diff --git a/pytest_fixtures/component/virtwho_config.py b/pytest_fixtures/component/virtwho_config.py index b8970232136..d46b1153490 100644 --- a/pytest_fixtures/component/virtwho_config.py +++ b/pytest_fixtures/component/virtwho_config.py @@ -24,11 +24,7 @@ def org_module(request, default_org, module_sca_manifest_org): @pytest.fixture def org_session(request, session, session_sca): - if 'sca' in request.module.__name__.split('.')[-1]: - org_session = session_sca - else: - org_session = session - return org_session + return session_sca if 'sca' in request.module.__name__.split('.')[-1] else session @pytest.fixture diff --git a/pytest_fixtures/core/contenthosts.py b/pytest_fixtures/core/contenthosts.py index d2bbb4cce39..89dcbb2dfa8 100644 --- a/pytest_fixtures/core/contenthosts.py +++ b/pytest_fixtures/core/contenthosts.py @@ -4,6 +4,7 @@ The functions in this module are read in the pytest_plugins/fixture_markers.py module All functions in this module will be treated as fixtures that apply the contenthost mark """ + from broker import Broker import pytest diff --git a/pytest_fixtures/core/xdist.py b/pytest_fixtures/core/xdist.py index 2495e4fa1c2..855cd2b1cfd 100644 --- a/pytest_fixtures/core/xdist.py +++ b/pytest_fixtures/core/xdist.py @@ -25,10 +25,7 @@ def align_to_satellite(request, worker_id, satellite_factory): settings.set("server.hostname", None) on_demand_sat = None - if worker_id in ['master', 'local']: - worker_pos = 0 - else: - worker_pos = int(worker_id.replace('gw', '')) + worker_pos = 0 if worker_id in ["master", "local"] else int(worker_id.replace("gw", "")) # attempt to add potential satellites from the broker inventory file if settings.server.inventory_filter: diff --git a/pytest_plugins/capsule_n-minus.py b/pytest_plugins/capsule_n-minus.py index f903e239757..9a7edf76b50 100644 --- a/pytest_plugins/capsule_n-minus.py +++ b/pytest_plugins/capsule_n-minus.py @@ -19,7 +19,6 @@ def pytest_addoption(parser): def pytest_collection_modifyitems(items, config): - if not config.getoption('n_minus', False): return diff --git a/pytest_plugins/requirements/req_updater.py b/pytest_plugins/requirements/req_updater.py index 664a9bb92a5..37d1aabc573 100644 --- a/pytest_plugins/requirements/req_updater.py +++ b/pytest_plugins/requirements/req_updater.py @@ -3,7 +3,6 @@ class ReqUpdater: - # Installed package name as key and its counterpart in requirements file as value package_deviates = { 'Betelgeuse': 'betelgeuse', diff --git a/pytest_plugins/requirements/update_requirements.py b/pytest_plugins/requirements/update_requirements.py index e2ad8840185..74494427ce3 100644 --- a/pytest_plugins/requirements/update_requirements.py +++ b/pytest_plugins/requirements/update_requirements.py @@ -1,4 +1,5 @@ """Plugin enables pytest to notify and update the requirements""" + from .req_updater import ReqUpdater updater = ReqUpdater() diff --git a/pytest_plugins/sanity_plugin.py b/pytest_plugins/sanity_plugin.py index 1d93a4b45f3..14d89b87d54 100644 --- a/pytest_plugins/sanity_plugin.py +++ b/pytest_plugins/sanity_plugin.py @@ -1,4 +1,4 @@ -""" A sanity testing plugin to assist in executing robottelo tests as sanity tests smartly +"""A sanity testing plugin to assist in executing robottelo tests as sanity tests smartly 1. Make installer test to run first which should set the hostname and all other tests then should run after that diff --git a/robottelo/cli/acs.py b/robottelo/cli/acs.py index 0368bc8d8d8..f610a5e983a 100644 --- a/robottelo/cli/acs.py +++ b/robottelo/cli/acs.py @@ -21,6 +21,7 @@ update Update an alternate content source. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/activationkey.py b/robottelo/cli/activationkey.py index 415a682c444..8a58b2f7bb2 100644 --- a/robottelo/cli/activationkey.py +++ b/robottelo/cli/activationkey.py @@ -25,6 +25,7 @@ subscriptions List associated subscriptions update Update an activation key """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/admin.py b/robottelo/cli/admin.py index ccae4bf47db..e6a32296400 100644 --- a/robottelo/cli/admin.py +++ b/robottelo/cli/admin.py @@ -12,6 +12,7 @@ Options: -h, --help Print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/ansible.py b/robottelo/cli/ansible.py index c9d42dbcb30..d717f8cd4d6 100644 --- a/robottelo/cli/ansible.py +++ b/robottelo/cli/ansible.py @@ -8,6 +8,7 @@ roles Manage ansible roles variables Manage ansible variables """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/architecture.py b/robottelo/cli/architecture.py index 02a9a173cf4..6bad9bf55c4 100644 --- a/robottelo/cli/architecture.py +++ b/robottelo/cli/architecture.py @@ -18,6 +18,7 @@ remove_operatingsystem Disassociate a resource update Update an architecture. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/arfreport.py b/robottelo/cli/arfreport.py index 05e04c0d7c3..a478a0ecfd7 100644 --- a/robottelo/cli/arfreport.py +++ b/robottelo/cli/arfreport.py @@ -16,6 +16,7 @@ list List ARF reports """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/auth.py b/robottelo/cli/auth.py index a6995ce7361..c50cf08fb60 100644 --- a/robottelo/cli/auth.py +++ b/robottelo/cli/auth.py @@ -11,6 +11,7 @@ logout Wipe your credentials status Information about current connections """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/base.py b/robottelo/cli/base.py index 8d258500b27..2827fdba5e5 100644 --- a/robottelo/cli/base.py +++ b/robottelo/cli/base.py @@ -1,4 +1,5 @@ """Generic base class for cli hammer commands.""" + import re from wait_for import wait_for diff --git a/robottelo/cli/bootdisk.py b/robottelo/cli/bootdisk.py index 50df399f7f3..f50c817cc57 100644 --- a/robottelo/cli/bootdisk.py +++ b/robottelo/cli/bootdisk.py @@ -14,6 +14,7 @@ host Download host image subnet Download subnet generic image """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/capsule.py b/robottelo/cli/capsule.py index bb6825cc783..c5ba0ec8918 100644 --- a/robottelo/cli/capsule.py +++ b/robottelo/cli/capsule.py @@ -19,6 +19,7 @@ refresh-features Refresh capsule features update Update a capsule """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/computeprofile.py b/robottelo/cli/computeprofile.py index b288e9c34c6..2856138f03f 100644 --- a/robottelo/cli/computeprofile.py +++ b/robottelo/cli/computeprofile.py @@ -18,6 +18,7 @@ -h, --help Print help Update a compute resource. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/computeresource.py b/robottelo/cli/computeresource.py index 1026d163787..48823ef1690 100644 --- a/robottelo/cli/computeresource.py +++ b/robottelo/cli/computeresource.py @@ -17,6 +17,7 @@ list List all compute resources. update Update a compute resource. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/content_credentials.py b/robottelo/cli/content_credentials.py index b7582dadd48..6844ef0083f 100644 --- a/robottelo/cli/content_credentials.py +++ b/robottelo/cli/content_credentials.py @@ -16,6 +16,7 @@ list List content credentials update Update a content credential """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/content_export.py b/robottelo/cli/content_export.py index 8d67ddfc032..c868e8483a4 100644 --- a/robottelo/cli/content_export.py +++ b/robottelo/cli/content_export.py @@ -19,6 +19,7 @@ list View content view export histories """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/content_import.py b/robottelo/cli/content_import.py index 18669dd49f8..d0910433dcb 100644 --- a/robottelo/cli/content_import.py +++ b/robottelo/cli/content_import.py @@ -16,6 +16,7 @@ version Imports a content archive to a content view version """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/contentview.py b/robottelo/cli/contentview.py index 17732f37617..57d69b7dd29 100644 --- a/robottelo/cli/contentview.py +++ b/robottelo/cli/contentview.py @@ -33,6 +33,7 @@ -h, --help print help """ + from robottelo.cli import hammer from robottelo.cli.base import Base, CLIError diff --git a/robottelo/cli/defaults.py b/robottelo/cli/defaults.py index 7d624930f95..0c7524a65cc 100644 --- a/robottelo/cli/defaults.py +++ b/robottelo/cli/defaults.py @@ -15,6 +15,7 @@ list List all the default parameters providers List all the providers """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/discoveredhost.py b/robottelo/cli/discoveredhost.py index 6404dfc89ec..99c1edffd6b 100644 --- a/robottelo/cli/discoveredhost.py +++ b/robottelo/cli/discoveredhost.py @@ -19,6 +19,7 @@ reboot Reboot a host refresh-facts Refresh the facts of a host """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/discoveryrule.py b/robottelo/cli/discoveryrule.py index 54bb5fc872e..9685132ef88 100644 --- a/robottelo/cli/discoveryrule.py +++ b/robottelo/cli/discoveryrule.py @@ -16,6 +16,7 @@ list List all discovery rules update Update a rule """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/docker.py b/robottelo/cli/docker.py index 01fe51cb786..f12eb949e90 100644 --- a/robottelo/cli/docker.py +++ b/robottelo/cli/docker.py @@ -1,4 +1,5 @@ """Docker related hammer commands""" + from robottelo.cli.base import Base diff --git a/robottelo/cli/domain.py b/robottelo/cli/domain.py index bb449177fcd..601aefc2eb1 100644 --- a/robottelo/cli/domain.py +++ b/robottelo/cli/domain.py @@ -18,6 +18,7 @@ set_parameter Create or update parameter for a domain. update Update a domain. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/environment.py b/robottelo/cli/environment.py index f47e2ba6aaf..1c981216e79 100644 --- a/robottelo/cli/environment.py +++ b/robottelo/cli/environment.py @@ -17,6 +17,7 @@ sc-params List all smart class parameters update Update an environment """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/erratum.py b/robottelo/cli/erratum.py index abe3fa57598..762a678398e 100644 --- a/robottelo/cli/erratum.py +++ b/robottelo/cli/erratum.py @@ -13,6 +13,7 @@ info Show an erratum list List errata """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/fact.py b/robottelo/cli/fact.py index 67a6d99d52a..3521e828b36 100644 --- a/robottelo/cli/fact.py +++ b/robottelo/cli/fact.py @@ -12,6 +12,7 @@ list List all fact values. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/file.py b/robottelo/cli/file.py index 3adb1fe1663..643df551b18 100644 --- a/robottelo/cli/file.py +++ b/robottelo/cli/file.py @@ -13,6 +13,7 @@ info Show a file list List files """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/filter.py b/robottelo/cli/filter.py index 395e44e13d6..595e67584a1 100644 --- a/robottelo/cli/filter.py +++ b/robottelo/cli/filter.py @@ -17,6 +17,7 @@ list List all filters update Update a filter """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/globalparam.py b/robottelo/cli/globalparam.py index 8bca35dc3cb..2dc069a062b 100644 --- a/robottelo/cli/globalparam.py +++ b/robottelo/cli/globalparam.py @@ -14,6 +14,7 @@ list List all common parameters. set Set a global parameter. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/gpgkey.py b/robottelo/cli/gpgkey.py index 4158fa04a70..610640e1c9b 100644 --- a/robottelo/cli/gpgkey.py +++ b/robottelo/cli/gpgkey.py @@ -16,6 +16,7 @@ list List GPG Keys update Update a GPG Key """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/hammer.py b/robottelo/cli/hammer.py index 4e35b0c7612..171cba6c0e3 100644 --- a/robottelo/cli/hammer.py +++ b/robottelo/cli/hammer.py @@ -1,4 +1,5 @@ """Helpers to interact with hammer command line utility.""" + import csv import json import re diff --git a/robottelo/cli/host.py b/robottelo/cli/host.py index dc45c9db887..6f093071704 100644 --- a/robottelo/cli/host.py +++ b/robottelo/cli/host.py @@ -39,6 +39,7 @@ update Update a host """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/host_registration.py b/robottelo/cli/host_registration.py index 8d0adaececd..61abe2a7d56 100644 --- a/robottelo/cli/host_registration.py +++ b/robottelo/cli/host_registration.py @@ -13,6 +13,7 @@ -h, --help Print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/hostcollection.py b/robottelo/cli/hostcollection.py index 839ef48d4f6..16e13d89110 100644 --- a/robottelo/cli/hostcollection.py +++ b/robottelo/cli/hostcollection.py @@ -23,6 +23,7 @@ remove-host Remove hosts from the host collection update Update a host collection """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/hostgroup.py b/robottelo/cli/hostgroup.py index 5be314b1a43..f13f7878901 100644 --- a/robottelo/cli/hostgroup.py +++ b/robottelo/cli/hostgroup.py @@ -22,6 +22,7 @@ set-parameter Create or update parameter for a hostgroup update Update a host group """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/http_proxy.py b/robottelo/cli/http_proxy.py index 08405e8d045..ba6f6b4debd 100644 --- a/robottelo/cli/http_proxy.py +++ b/robottelo/cli/http_proxy.py @@ -16,6 +16,7 @@ Options: -h, --help Print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/job_invocation.py b/robottelo/cli/job_invocation.py index fe02dae4d74..8e8e37baca8 100644 --- a/robottelo/cli/job_invocation.py +++ b/robottelo/cli/job_invocation.py @@ -15,6 +15,7 @@ rerun Rerun the job """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/job_template.py b/robottelo/cli/job_template.py index 7b072cc0612..d33e77b09ea 100644 --- a/robottelo/cli/job_template.py +++ b/robottelo/cli/job_template.py @@ -16,6 +16,7 @@ list List job templates update Update a job template """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/ldapauthsource.py b/robottelo/cli/ldapauthsource.py index fabb6a9c0bd..1d460528f4f 100644 --- a/robottelo/cli/ldapauthsource.py +++ b/robottelo/cli/ldapauthsource.py @@ -15,6 +15,7 @@ list List all LDAP authentication sources update Update an LDAP authentication source """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/lifecycleenvironment.py b/robottelo/cli/lifecycleenvironment.py index c22d2268746..b6896d80f59 100644 --- a/robottelo/cli/lifecycleenvironment.py +++ b/robottelo/cli/lifecycleenvironment.py @@ -16,6 +16,7 @@ delete Destroy an environment info Show an environment """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/location.py b/robottelo/cli/location.py index aa3dd234970..82d5789139a 100644 --- a/robottelo/cli/location.py +++ b/robottelo/cli/location.py @@ -36,6 +36,7 @@ remove-user Disassociate an user update Update a location """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/medium.py b/robottelo/cli/medium.py index 8372d96a7cf..6958254b07c 100644 --- a/robottelo/cli/medium.py +++ b/robottelo/cli/medium.py @@ -18,6 +18,7 @@ remove_operatingsystem Disassociate a resource update Update a medium. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/model.py b/robottelo/cli/model.py index 419f2ff62a2..453d5a55d18 100644 --- a/robottelo/cli/model.py +++ b/robottelo/cli/model.py @@ -16,6 +16,7 @@ list List all models. update Update a model. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/module_stream.py b/robottelo/cli/module_stream.py index 1dcb8d9ee54..bc0a248e44f 100644 --- a/robottelo/cli/module_stream.py +++ b/robottelo/cli/module_stream.py @@ -13,6 +13,7 @@ info Show a module-stream list List module-streams """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/operatingsys.py b/robottelo/cli/operatingsys.py index 8bf4411d56d..361259d275e 100644 --- a/robottelo/cli/operatingsys.py +++ b/robottelo/cli/operatingsys.py @@ -27,6 +27,7 @@ operating system. update Update an OS. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/org.py b/robottelo/cli/org.py index 38103aff3a5..21d2c7c053b 100644 --- a/robottelo/cli/org.py +++ b/robottelo/cli/org.py @@ -40,6 +40,7 @@ organization. update Update an organization """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/ostreebranch.py b/robottelo/cli/ostreebranch.py index 5d68869978f..f828299133f 100644 --- a/robottelo/cli/ostreebranch.py +++ b/robottelo/cli/ostreebranch.py @@ -14,6 +14,7 @@ list List ostree_branches """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/package.py b/robottelo/cli/package.py index 75533348ad3..df566b735d9 100644 --- a/robottelo/cli/package.py +++ b/robottelo/cli/package.py @@ -13,6 +13,7 @@ info Show a package list List packages """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/partitiontable.py b/robottelo/cli/partitiontable.py index eb0ebd7fc9e..dc15e25563a 100644 --- a/robottelo/cli/partitiontable.py +++ b/robottelo/cli/partitiontable.py @@ -19,6 +19,7 @@ remove_operatingsystem Disassociate a resource update Update a ptable. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/product.py b/robottelo/cli/product.py index 7a7f03eeff4..90e0a534549 100644 --- a/robottelo/cli/product.py +++ b/robottelo/cli/product.py @@ -20,6 +20,7 @@ update Update a product update-proxy Updates an HTTP Proxy for a product """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/proxy.py b/robottelo/cli/proxy.py index c6887940902..a7722b22935 100644 --- a/robottelo/cli/proxy.py +++ b/robottelo/cli/proxy.py @@ -18,6 +18,7 @@ refresh-features Refresh smart proxy features update Update a smart proxy. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/puppet.py b/robottelo/cli/puppet.py index b340fc75a5e..acc502fafc2 100644 --- a/robottelo/cli/puppet.py +++ b/robottelo/cli/puppet.py @@ -14,6 +14,7 @@ list List all puppetclasses. sc-params List all smart class parameters """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/realm.py b/robottelo/cli/realm.py index bbbcc11b0a9..ce89717fc88 100644 --- a/robottelo/cli/realm.py +++ b/robottelo/cli/realm.py @@ -16,6 +16,7 @@ Options: -h, --help print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/recurring_logic.py b/robottelo/cli/recurring_logic.py index 71c494c68d7..85c6e7ebba6 100644 --- a/robottelo/cli/recurring_logic.py +++ b/robottelo/cli/recurring_logic.py @@ -11,6 +11,7 @@ info Show recurring logic details list List recurring logics """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/report.py b/robottelo/cli/report.py index 50ca0c1a8b9..e5dadade512 100644 --- a/robottelo/cli/report.py +++ b/robottelo/cli/report.py @@ -15,6 +15,7 @@ list List reports. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/report_template.py b/robottelo/cli/report_template.py index 50646e3cd4b..5f66c1ee64f 100644 --- a/robottelo/cli/report_template.py +++ b/robottelo/cli/report_template.py @@ -21,6 +21,7 @@ schedule Schedule generating of a report update Update a report template """ + from os import chmod from tempfile import mkstemp diff --git a/robottelo/cli/repository.py b/robottelo/cli/repository.py index d5ac3caf7a1..a17cc9fbcba 100644 --- a/robottelo/cli/repository.py +++ b/robottelo/cli/repository.py @@ -19,6 +19,7 @@ update Update a repository upload-content Upload content into the repository """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/repository_set.py b/robottelo/cli/repository_set.py index 65dede4e28d..7c2afb6481d 100644 --- a/robottelo/cli/repository_set.py +++ b/robottelo/cli/repository_set.py @@ -19,6 +19,7 @@ info Show a repository list List of repositories """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/rex_feature.py b/robottelo/cli/rex_feature.py index 354fdc51ffe..b583a9e3536 100644 --- a/robottelo/cli/rex_feature.py +++ b/robottelo/cli/rex_feature.py @@ -15,6 +15,7 @@ update Update a job template """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/role.py b/robottelo/cli/role.py index d83234fc8a0..88eb6a40cd7 100644 --- a/robottelo/cli/role.py +++ b/robottelo/cli/role.py @@ -17,6 +17,7 @@ list List all roles. update Update an role. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/scap_policy.py b/robottelo/cli/scap_policy.py index 7235d2470cf..26479007804 100644 --- a/robottelo/cli/scap_policy.py +++ b/robottelo/cli/scap_policy.py @@ -16,6 +16,7 @@ list List Policies update Update a Policy """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/scap_tailoring_files.py b/robottelo/cli/scap_tailoring_files.py index 0e75af17b46..912c25a639a 100644 --- a/robottelo/cli/scap_tailoring_files.py +++ b/robottelo/cli/scap_tailoring_files.py @@ -17,6 +17,7 @@ list List Tailoring files update Update a Tailoring file """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/scapcontent.py b/robottelo/cli/scapcontent.py index 160da1d0d1e..8e384488d8c 100644 --- a/robottelo/cli/scapcontent.py +++ b/robottelo/cli/scapcontent.py @@ -16,6 +16,7 @@ list List SCAP contents update Update an SCAP content """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/scparams.py b/robottelo/cli/scparams.py index fea0431a5e1..9e661b8f613 100644 --- a/robottelo/cli/scparams.py +++ b/robottelo/cli/scparams.py @@ -18,6 +18,7 @@ variable update Update a smart class parameter """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/settings.py b/robottelo/cli/settings.py index 49777104d4f..13c45776a51 100644 --- a/robottelo/cli/settings.py +++ b/robottelo/cli/settings.py @@ -13,6 +13,7 @@ list List all settings set Update a setting """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/simple_content_access.py b/robottelo/cli/simple_content_access.py index da741131d92..0a84dd3f254 100644 --- a/robottelo/cli/simple_content_access.py +++ b/robottelo/cli/simple_content_access.py @@ -16,6 +16,7 @@ Simple Content Access enabled """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/sm_advanced.py b/robottelo/cli/sm_advanced.py index 42ba037b811..b6ba5808e00 100644 --- a/robottelo/cli/sm_advanced.py +++ b/robottelo/cli/sm_advanced.py @@ -88,6 +88,7 @@ Options: -h, --help print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/sm_advanced_by_tag.py b/robottelo/cli/sm_advanced_by_tag.py index afcc1018ab4..f90758e68fc 100644 --- a/robottelo/cli/sm_advanced_by_tag.py +++ b/robottelo/cli/sm_advanced_by_tag.py @@ -17,6 +17,7 @@ Options: -h, --help print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/sm_backup.py b/robottelo/cli/sm_backup.py index 8da59080151..594c2390785 100644 --- a/robottelo/cli/sm_backup.py +++ b/robottelo/cli/sm_backup.py @@ -14,6 +14,7 @@ Options: -h, --help print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/sm_health.py b/robottelo/cli/sm_health.py index f8da5ca309c..c023a943892 100644 --- a/robottelo/cli/sm_health.py +++ b/robottelo/cli/sm_health.py @@ -14,6 +14,7 @@ Options: -h, --help print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/sm_maintenance_mode.py b/robottelo/cli/sm_maintenance_mode.py index 6cbe43e367d..8e9ef09d67f 100644 --- a/robottelo/cli/sm_maintenance_mode.py +++ b/robottelo/cli/sm_maintenance_mode.py @@ -12,6 +12,7 @@ Options: -h, --help print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/sm_packages.py b/robottelo/cli/sm_packages.py index d4674279172..96aa69531bb 100644 --- a/robottelo/cli/sm_packages.py +++ b/robottelo/cli/sm_packages.py @@ -18,6 +18,7 @@ Options: -h, --help print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/sm_restore.py b/robottelo/cli/sm_restore.py index 0bd68c9fe61..cad914e5192 100644 --- a/robottelo/cli/sm_restore.py +++ b/robottelo/cli/sm_restore.py @@ -12,6 +12,7 @@ -i, --incremental Restore an incremental backup -h, --help print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/sm_service.py b/robottelo/cli/sm_service.py index c2ec5f32ca7..212d33bda19 100644 --- a/robottelo/cli/sm_service.py +++ b/robottelo/cli/sm_service.py @@ -18,6 +18,7 @@ Options: -h, --help print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/sm_upgrade.py b/robottelo/cli/sm_upgrade.py index 77712b41593..a30e1582182 100644 --- a/robottelo/cli/sm_upgrade.py +++ b/robottelo/cli/sm_upgrade.py @@ -14,6 +14,7 @@ Options: -h, --help print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/srpm.py b/robottelo/cli/srpm.py index 62578bbaa69..689a17c64ef 100644 --- a/robottelo/cli/srpm.py +++ b/robottelo/cli/srpm.py @@ -10,6 +10,7 @@ info Show a SRPM Details list List srpms """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/subnet.py b/robottelo/cli/subnet.py index e0bf4a0d6bd..5fc61ddc561 100644 --- a/robottelo/cli/subnet.py +++ b/robottelo/cli/subnet.py @@ -17,6 +17,7 @@ update Update a subnet """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/subscription.py b/robottelo/cli/subscription.py index 0e22eaeaccd..916a9068155 100644 --- a/robottelo/cli/subscription.py +++ b/robottelo/cli/subscription.py @@ -18,6 +18,7 @@ upload Upload a subscription manifest """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/syncplan.py b/robottelo/cli/syncplan.py index 9894335ab05..b4f59d3eede 100644 --- a/robottelo/cli/syncplan.py +++ b/robottelo/cli/syncplan.py @@ -16,6 +16,7 @@ list List sync plans update """ + from robottelo.cli.base import Base from robottelo.exceptions import CLIError diff --git a/robottelo/cli/task.py b/robottelo/cli/task.py index b2a25142407..79a19c3034c 100644 --- a/robottelo/cli/task.py +++ b/robottelo/cli/task.py @@ -14,6 +14,7 @@ progress Show the progress of the task resume Resume all tasks paused in error state """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/template.py b/robottelo/cli/template.py index 3729fc4bf76..e2836346a9c 100644 --- a/robottelo/cli/template.py +++ b/robottelo/cli/template.py @@ -20,6 +20,7 @@ remove-operatingsystem Disassociate an operating system update Update a provisioning template """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/template_input.py b/robottelo/cli/template_input.py index 9b861dbf9a9..7d0a73dadf5 100644 --- a/robottelo/cli/template_input.py +++ b/robottelo/cli/template_input.py @@ -15,6 +15,7 @@ info Show template input details list List template inputs """ + from robottelo.cli.base import Base, CLIError diff --git a/robottelo/cli/template_sync.py b/robottelo/cli/template_sync.py index 72ee70fa00f..e3da9dbf20c 100644 --- a/robottelo/cli/template_sync.py +++ b/robottelo/cli/template_sync.py @@ -39,6 +39,7 @@ prefix The string all imported templates should begin with. repo Override the default repo from settings. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/user.py b/robottelo/cli/user.py index eb37133e786..52dc7233f52 100644 --- a/robottelo/cli/user.py +++ b/robottelo/cli/user.py @@ -20,6 +20,7 @@ ssh-keys Managing User SSH Keys. update Update an user. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/usergroup.py b/robottelo/cli/usergroup.py index f29ad3f5573..71344fc3717 100644 --- a/robottelo/cli/usergroup.py +++ b/robottelo/cli/usergroup.py @@ -20,6 +20,7 @@ remove-user-group Disassociate an user group update Update a user group """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/virt_who_config.py b/robottelo/cli/virt_who_config.py index 4cb6dd1223b..7e2e2e05b6b 100644 --- a/robottelo/cli/virt_who_config.py +++ b/robottelo/cli/virt_who_config.py @@ -19,6 +19,7 @@ list List of virt-who configurations update Update a virt-who configuration """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/webhook.py b/robottelo/cli/webhook.py index ea37b6c7779..a9c311fc60b 100644 --- a/robottelo/cli/webhook.py +++ b/robottelo/cli/webhook.py @@ -13,12 +13,12 @@ Options: -h, --help Print help """ + from robottelo.cli.base import Base, CLIError from robottelo.constants import WEBHOOK_EVENTS, WEBHOOK_METHODS class Webhook(Base): - command_base = 'webhook' @classmethod diff --git a/robottelo/constants/__init__.py b/robottelo/constants/__init__.py index 2af692e157b..3de512fb4a0 100644 --- a/robottelo/constants/__init__.py +++ b/robottelo/constants/__init__.py @@ -1,4 +1,5 @@ """Defines various constants""" + from pathlib import Path from box import Box @@ -2070,6 +2071,7 @@ class Colored(Box): EXPIRED_MANIFEST = 'expired-manifest.zip' + # Data File Paths class DataFile(Box): """The boxed Data directory class with its attributes pointing to the Data directory files""" diff --git a/robottelo/content_info.py b/robottelo/content_info.py index fd404f5a7d9..803692a0823 100644 --- a/robottelo/content_info.py +++ b/robottelo/content_info.py @@ -1,4 +1,5 @@ """Miscellaneous content helper functions""" + import os import re diff --git a/robottelo/host_helpers/api_factory.py b/robottelo/host_helpers/api_factory.py index 1316bca9078..d0591770888 100644 --- a/robottelo/host_helpers/api_factory.py +++ b/robottelo/host_helpers/api_factory.py @@ -2,6 +2,7 @@ It is not meant to be used directly, but as part of a robottelo.hosts.Satellite instance example: my_satellite.api_factory.api_method() """ + from contextlib import contextmanager from datetime import datetime import time diff --git a/robottelo/host_helpers/cli_factory.py b/robottelo/host_helpers/cli_factory.py index cc325002229..4e62d3d0708 100644 --- a/robottelo/host_helpers/cli_factory.py +++ b/robottelo/host_helpers/cli_factory.py @@ -3,6 +3,7 @@ It is not meant to be used directly, but as part of a robottelo.hosts.Satellite instance example: my_satellite.cli_factory.make_org() """ + import datetime from functools import lru_cache, partial import inspect diff --git a/robottelo/host_helpers/contenthost_mixins.py b/robottelo/host_helpers/contenthost_mixins.py index 3b01ef2dfff..c76d23405fe 100644 --- a/robottelo/host_helpers/contenthost_mixins.py +++ b/robottelo/host_helpers/contenthost_mixins.py @@ -1,4 +1,5 @@ """A collection of mixins for robottelo.hosts classes""" + from functools import cached_property import json from tempfile import NamedTemporaryFile diff --git a/robottelo/host_helpers/repository_mixins.py b/robottelo/host_helpers/repository_mixins.py index 0ff2bdecd68..a55bc53ff85 100644 --- a/robottelo/host_helpers/repository_mixins.py +++ b/robottelo/host_helpers/repository_mixins.py @@ -2,6 +2,7 @@ All the Repository classes in this module are supposed to use from sat_object.cli_factory object. The direct import of the repo classes in this module is prohibited !!!!! """ + import inspect import sys @@ -509,7 +510,6 @@ class RepositoryCollection: satellite = None def __init__(self, distro=None, repositories=None): - self._items = [] if distro is not None and distro not in constants.DISTROS_SUPPORTED: diff --git a/robottelo/host_helpers/satellite_mixins.py b/robottelo/host_helpers/satellite_mixins.py index d20a70d2d15..58fe5b5d237 100644 --- a/robottelo/host_helpers/satellite_mixins.py +++ b/robottelo/host_helpers/satellite_mixins.py @@ -308,7 +308,7 @@ def validate_pulp_filepath( ): """Checks the existence of certain files in a pulp dir""" extension_query = ' -o '.join([f'-name "{file}"' for file in file_names]) - result = self.execute(fr'find {dir_path}{org.name} -type f \( {extension_query} \)') + result = self.execute(rf'find {dir_path}{org.name} -type f \( {extension_query} \)') return result.stdout diff --git a/robottelo/host_helpers/ui_factory.py b/robottelo/host_helpers/ui_factory.py index df156ad6d6f..84c1498bcd5 100644 --- a/robottelo/host_helpers/ui_factory.py +++ b/robottelo/host_helpers/ui_factory.py @@ -3,6 +3,7 @@ Need to pass the existing session object to the ui_factory method as a parameter example: my_satellite.ui_factory(session).ui_method() """ + from fauxfactory import gen_string from robottelo.constants import DEFAULT_CV, ENVIRONMENT diff --git a/robottelo/hosts.py b/robottelo/hosts.py index 501e69d4338..3c6e2771c90 100644 --- a/robottelo/hosts.py +++ b/robottelo/hosts.py @@ -63,7 +63,7 @@ POWER_OPERATIONS = { VmState.RUNNING: 'running', VmState.STOPPED: 'stopped', - 'reboot': 'reboot' + 'reboot': 'reboot', # TODO paused, suspended, shelved? } @@ -840,10 +840,7 @@ def register_contenthost( registration. """ - if username and password: - userpass = f' --username {username} --password {password}' - else: - userpass = '' + userpass = f' --username {username} --password {password}' if username and password else '' # Setup the base command cmd = 'subscription-manager register' if org: diff --git a/robottelo/ssh.py b/robottelo/ssh.py index 8b72bed3497..1be3a65a811 100644 --- a/robottelo/ssh.py +++ b/robottelo/ssh.py @@ -1,4 +1,5 @@ """Utility module to handle the shared ssh connection.""" + from robottelo.cli import hammer diff --git a/robottelo/utils/datafactory.py b/robottelo/utils/datafactory.py index 9d9cf134b85..6f571986a56 100644 --- a/robottelo/utils/datafactory.py +++ b/robottelo/utils/datafactory.py @@ -1,4 +1,5 @@ """Data Factory for all entities""" + from functools import wraps import random import string diff --git a/robottelo/utils/decorators/__init__.py b/robottelo/utils/decorators/__init__.py index 371afd50f16..3dd3c9edeb3 100644 --- a/robottelo/utils/decorators/__init__.py +++ b/robottelo/utils/decorators/__init__.py @@ -1,4 +1,5 @@ """Implements various decorators""" + from functools import wraps OBJECT_CACHE = {} diff --git a/robottelo/utils/decorators/func_locker.py b/robottelo/utils/decorators/func_locker.py index e4feaa46f2a..83632428313 100644 --- a/robottelo/utils/decorators/func_locker.py +++ b/robottelo/utils/decorators/func_locker.py @@ -39,6 +39,7 @@ def test_that_conflict_with_test_to_lock(self) with locking_function(self.test_to_lock): # do some operations that conflict with test_to_lock """ + from contextlib import contextmanager import functools import inspect @@ -223,7 +224,6 @@ def lock_function( class_name = '.'.join(class_names) def main_wrapper(func): - func.__class_name__ = class_name func.__function_locked__ = True diff --git a/robottelo/utils/decorators/func_shared/file_storage.py b/robottelo/utils/decorators/func_shared/file_storage.py index 70a6d6af889..e7935300c86 100644 --- a/robottelo/utils/decorators/func_shared/file_storage.py +++ b/robottelo/utils/decorators/func_shared/file_storage.py @@ -45,7 +45,6 @@ class FileStorageHandler(BaseStorageHandler): """Key value file storage handler.""" def __init__(self, root_dir=None, create=True, lock_timeout=LOCK_TIMEOUT): - if root_dir is None: root_dir = _get_root_dir() diff --git a/robottelo/utils/decorators/func_shared/redis_storage.py b/robottelo/utils/decorators/func_shared/redis_storage.py index 571ac0ac699..74a5b8d0ecc 100644 --- a/robottelo/utils/decorators/func_shared/redis_storage.py +++ b/robottelo/utils/decorators/func_shared/redis_storage.py @@ -23,7 +23,6 @@ def __init__( password=REDIS_PASSWORD, lock_timeout=LOCK_TIMEOUT, ): - self._lock_timeout = lock_timeout self._client = redis.StrictRedis(host=host, port=port, db=db, password=password) diff --git a/robottelo/utils/decorators/func_shared/shared.py b/robottelo/utils/decorators/func_shared/shared.py index 4c325084c4f..50e2d371fbe 100644 --- a/robottelo/utils/decorators/func_shared/shared.py +++ b/robottelo/utils/decorators/func_shared/shared.py @@ -84,6 +84,7 @@ def shared_class_method(cls, org=None, repo=None): return dict(org=cls.org, repo=cls.repo} """ + import datetime import functools import hashlib @@ -213,7 +214,6 @@ def __init__( inject=False, injected_kw='_inject', ): - if storage_handler is None: storage_handler = _get_default_storage_handler() @@ -258,7 +258,6 @@ def _encode_result_kwargs(self, kwargs): return kwargs def _call_function(self): - retries = self._max_retries if not retries: retries = 1 @@ -465,11 +464,7 @@ def _get_function_name_key(function_name, scope=None, scope_kwargs=None, scope_c scope_name = _get_scope_name( scope=scope, scope_kwargs=scope_kwargs, scope_context=scope_context ) - if scope_name: - function_name_key = '.'.join([scope_name, function_name]) - else: - function_name_key = function_name - return function_name_key + return '.'.join([scope_name, function_name]) if scope_name else function_name def shared( diff --git a/robottelo/utils/manifest.py b/robottelo/utils/manifest.py index 52c220f3c59..aa377ae73e3 100644 --- a/robottelo/utils/manifest.py +++ b/robottelo/utils/manifest.py @@ -69,9 +69,9 @@ def manifest_clone(self, org_environment_access=False, name='default'): consumer_data['uuid'] = str(uuid.uuid1()) if org_environment_access: consumer_data['contentAccessMode'] = 'org_environment' - consumer_data['owner'][ - 'contentAccessModeList' - ] = 'entitlement,org_environment' + consumer_data['owner']['contentAccessModeList'] = ( + 'entitlement,org_environment' + ) new_consumer_export_zip.writestr(name, json.dumps(consumer_data)) else: new_consumer_export_zip.writestr(name, consumer_export_zip.read(name)) diff --git a/robottelo/utils/ohsnap.py b/robottelo/utils/ohsnap.py index 96241a759b6..83669cdb61e 100644 --- a/robottelo/utils/ohsnap.py +++ b/robottelo/utils/ohsnap.py @@ -1,4 +1,5 @@ """Utility module to communicate with Ohsnap API""" + from box import Box from packaging.version import Version import requests diff --git a/robottelo/utils/shared_resource.py b/robottelo/utils/shared_resource.py index 0ad0bd92e46..fa17f3f0c14 100644 --- a/robottelo/utils/shared_resource.py +++ b/robottelo/utils/shared_resource.py @@ -21,6 +21,7 @@ ... yield target_sat # give the upgraded satellite to the test ... # Do post-upgrade cleanup steps if any """ + import json from pathlib import Path import time diff --git a/robottelo/utils/ssh.py b/robottelo/utils/ssh.py index 8b72bed3497..1be3a65a811 100644 --- a/robottelo/utils/ssh.py +++ b/robottelo/utils/ssh.py @@ -1,4 +1,5 @@ """Utility module to handle the shared ssh connection.""" + from robottelo.cli import hammer diff --git a/robottelo/utils/vault.py b/robottelo/utils/vault.py index 97f95755bbd..417fa2c13bd 100644 --- a/robottelo/utils/vault.py +++ b/robottelo/utils/vault.py @@ -1,4 +1,5 @@ """Hashicorp Vault Utils where vault CLI is wrapped to perform vault operations""" + import json import os import re diff --git a/robottelo/utils/virtwho.py b/robottelo/utils/virtwho.py index 9d2b033d6ee..0013071fba9 100644 --- a/robottelo/utils/virtwho.py +++ b/robottelo/utils/virtwho.py @@ -1,4 +1,5 @@ """Utility module to handle the virtwho configure UI/CLI/API testing""" + import json import re import uuid diff --git a/scripts/config_helpers.py b/scripts/config_helpers.py index cf422588b05..bc559c5091b 100644 --- a/scripts/config_helpers.py +++ b/scripts/config_helpers.py @@ -1,4 +1,5 @@ """A series of commands to help with robottelo configuration""" + from pathlib import Path import click diff --git a/scripts/graph_entities.py b/scripts/graph_entities.py index 46038a3e3b0..bd4accfa2ed 100755 --- a/scripts/graph_entities.py +++ b/scripts/graph_entities.py @@ -7,6 +7,7 @@ command provided by the make file in the parent directory. """ + import inspect from nailgun import entities, entity_mixins diff --git a/scripts/hammer_command_tree.py b/scripts/hammer_command_tree.py index 55a10add78e..580447047cc 100755 --- a/scripts/hammer_command_tree.py +++ b/scripts/hammer_command_tree.py @@ -2,6 +2,7 @@ help. """ + import json from robottelo import ssh diff --git a/scripts/token_editor.py b/scripts/token_editor.py index 923aef02aa0..f492c8c3fb2 100755 --- a/scripts/token_editor.py +++ b/scripts/token_editor.py @@ -4,6 +4,7 @@ Reads Python test modules under test/foreman and edit docstring tokens' prefix from ``OLD_TOKEN_PREFIX`` to ``NEW_TOKEN_PREFIX``. """ + import glob import os import re @@ -30,6 +31,6 @@ for test_module in test_modules: with open(test_module) as handler: content = handler.read() - content = TOKEN_RE.sub(fr'{NEW_TOKEN_PREFIX}\1:', content) + content = TOKEN_RE.sub(rf'{NEW_TOKEN_PREFIX}\1:', content) with open(test_module, 'w') as handler: handler.write(content) diff --git a/scripts/tokenize_customer_scenario.py b/scripts/tokenize_customer_scenario.py index 14a0cbf75a5..f810e00c4e0 100644 --- a/scripts/tokenize_customer_scenario.py +++ b/scripts/tokenize_customer_scenario.py @@ -13,6 +13,7 @@ On robottelo root dir run: $ python scripts/tokenize_customer_scenario.py """ + import codemod from codemod import Query, regex_suggestor, run_interactive from codemod.helpers import path_filter diff --git a/scripts/validate_config.py b/scripts/validate_config.py index a01f350ae6e..04af5d7ac48 100644 --- a/scripts/validate_config.py +++ b/scripts/validate_config.py @@ -1,4 +1,5 @@ """Usage: python scripts/validate_config.py""" + from dynaconf.validator import ValidationError from robottelo.config import get_settings diff --git a/tests/foreman/api/test_acs.py b/tests/foreman/api/test_acs.py index 7821db07fc5..a8b24345bc6 100644 --- a/tests/foreman/api/test_acs.py +++ b/tests/foreman/api/test_acs.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest from requests.exceptions import HTTPError diff --git a/tests/foreman/api/test_activationkey.py b/tests/foreman/api/test_activationkey.py index ef5add381fc..36ee295ef9a 100644 --- a/tests/foreman/api/test_activationkey.py +++ b/tests/foreman/api/test_activationkey.py @@ -12,6 +12,7 @@ """ + import http from fauxfactory import gen_integer, gen_string diff --git a/tests/foreman/api/test_ansible.py b/tests/foreman/api/test_ansible.py index 435501d0696..71d47b860d2 100644 --- a/tests/foreman/api/test_ansible.py +++ b/tests/foreman/api/test_ansible.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + from fauxfactory import gen_string import pytest from wait_for import wait_for diff --git a/tests/foreman/api/test_architecture.py b/tests/foreman/api/test_architecture.py index 362abbfae32..b40173fe21f 100644 --- a/tests/foreman/api/test_architecture.py +++ b/tests/foreman/api/test_architecture.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_choice import pytest from requests.exceptions import HTTPError diff --git a/tests/foreman/api/test_audit.py b/tests/foreman/api/test_audit.py index a90eda83884..430657d9c8e 100644 --- a/tests/foreman/api/test_audit.py +++ b/tests/foreman/api/test_audit.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.utils.datafactory import gen_string diff --git a/tests/foreman/api/test_bookmarks.py b/tests/foreman/api/test_bookmarks.py index 5d5833ef563..9b532a48155 100644 --- a/tests/foreman/api/test_bookmarks.py +++ b/tests/foreman/api/test_bookmarks.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from fauxfactory import gen_string diff --git a/tests/foreman/api/test_capsule.py b/tests/foreman/api/test_capsule.py index 7cbb989f940..5600cc040a8 100644 --- a/tests/foreman/api/test_capsule.py +++ b/tests/foreman/api/test_capsule.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + from fauxfactory import gen_string, gen_url import pytest from requests import HTTPError diff --git a/tests/foreman/api/test_classparameters.py b/tests/foreman/api/test_classparameters.py index 931a11edec2..d74e708bd61 100644 --- a/tests/foreman/api/test_classparameters.py +++ b/tests/foreman/api/test_classparameters.py @@ -11,6 +11,7 @@ :Team: Rocket """ + import json from random import choice diff --git a/tests/foreman/api/test_computeprofile.py b/tests/foreman/api/test_computeprofile.py index 6d374bc8b34..785278ee2b6 100644 --- a/tests/foreman/api/test_computeprofile.py +++ b/tests/foreman/api/test_computeprofile.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from requests.exceptions import HTTPError diff --git a/tests/foreman/api/test_computeresource_azurerm.py b/tests/foreman/api/test_computeresource_azurerm.py index 47bf8313066..d8751f65786 100644 --- a/tests/foreman/api/test_computeresource_azurerm.py +++ b/tests/foreman/api/test_computeresource_azurerm.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/api/test_computeresource_gce.py b/tests/foreman/api/test_computeresource_gce.py index 2d088f4f2a2..8f27e9b98fe 100644 --- a/tests/foreman/api/test_computeresource_gce.py +++ b/tests/foreman/api/test_computeresource_gce.py @@ -14,6 +14,7 @@ :CaseImportance: High """ + import random from fauxfactory import gen_string diff --git a/tests/foreman/api/test_computeresource_libvirt.py b/tests/foreman/api/test_computeresource_libvirt.py index ad95fb9f202..ce0c0ff0b9b 100644 --- a/tests/foreman/api/test_computeresource_libvirt.py +++ b/tests/foreman/api/test_computeresource_libvirt.py @@ -15,6 +15,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest from requests.exceptions import HTTPError diff --git a/tests/foreman/api/test_contentcredentials.py b/tests/foreman/api/test_contentcredentials.py index 3f088ae6253..2263edca0d1 100644 --- a/tests/foreman/api/test_contentcredentials.py +++ b/tests/foreman/api/test_contentcredentials.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from copy import copy from fauxfactory import gen_string diff --git a/tests/foreman/api/test_contentview.py b/tests/foreman/api/test_contentview.py index b8b9024b3f2..aef753d4459 100644 --- a/tests/foreman/api/test_contentview.py +++ b/tests/foreman/api/test_contentview.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime, timedelta import random diff --git a/tests/foreman/api/test_contentviewfilter.py b/tests/foreman/api/test_contentviewfilter.py index 6360bf5da16..0516582ed5e 100644 --- a/tests/foreman/api/test_contentviewfilter.py +++ b/tests/foreman/api/test_contentviewfilter.py @@ -15,6 +15,7 @@ :CaseImportance: High """ + import http from random import randint diff --git a/tests/foreman/api/test_contentviewversion.py b/tests/foreman/api/test_contentviewversion.py index 5f3414456e3..b870ffb19f7 100644 --- a/tests/foreman/api/test_contentviewversion.py +++ b/tests/foreman/api/test_contentviewversion.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest from requests.exceptions import HTTPError diff --git a/tests/foreman/api/test_convert2rhel.py b/tests/foreman/api/test_convert2rhel.py index e81a1abb086..9d61692796a 100644 --- a/tests/foreman/api/test_convert2rhel.py +++ b/tests/foreman/api/test_convert2rhel.py @@ -11,6 +11,7 @@ :Team: Rocket """ + import pytest import requests diff --git a/tests/foreman/api/test_discoveredhost.py b/tests/foreman/api/test_discoveredhost.py index 976c1812e47..31ad0b1d415 100644 --- a/tests/foreman/api/test_discoveredhost.py +++ b/tests/foreman/api/test_discoveredhost.py @@ -9,6 +9,7 @@ :CaseAutomation: Automated """ + import re from fauxfactory import gen_choice, gen_ipaddr, gen_mac, gen_string diff --git a/tests/foreman/api/test_discoveryrule.py b/tests/foreman/api/test_discoveryrule.py index 3d1c1f4bf48..2ffddb51711 100644 --- a/tests/foreman/api/test_discoveryrule.py +++ b/tests/foreman/api/test_discoveryrule.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_choice, gen_integer, gen_string import pytest from requests.exceptions import HTTPError diff --git a/tests/foreman/api/test_docker.py b/tests/foreman/api/test_docker.py index eab9d213db5..6bebe5e81f1 100644 --- a/tests/foreman/api/test_docker.py +++ b/tests/foreman/api/test_docker.py @@ -7,6 +7,7 @@ :CaseImportance: High """ + from random import choice, randint, shuffle from fauxfactory import gen_string, gen_url diff --git a/tests/foreman/api/test_environment.py b/tests/foreman/api/test_environment.py index 02f7a3928e3..d0e62dbe6a9 100644 --- a/tests/foreman/api/test_environment.py +++ b/tests/foreman/api/test_environment.py @@ -15,6 +15,7 @@ :CaseImportance: Critical """ + from fauxfactory import gen_string import pytest from requests.exceptions import HTTPError diff --git a/tests/foreman/api/test_errata.py b/tests/foreman/api/test_errata.py index 81974401a9f..8fd717b44fd 100644 --- a/tests/foreman/api/test_errata.py +++ b/tests/foreman/api/test_errata.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + # For ease of use hc refers to host-collection throughout this document from time import sleep, time @@ -122,8 +123,7 @@ def _validate_errata_counts(host, errata_type, expected_value, timeout=120): sleep(5) else: pytest.fail( - 'Host {} contains {} {} errata, but expected to contain ' - '{} of them'.format( + 'Host {} contains {} {} errata, but expected to contain {} of them'.format( host.name, host.content_facet_attributes['errata_counts'][errata_type], errata_type, @@ -149,8 +149,7 @@ def _fetch_available_errata(host, expected_amount=None, timeout=120): errata = host.errata() else: pytest.fail( - 'Host {} contains {} available errata, but expected to ' - 'contain {} of them'.format( + 'Host {} contains {} available errata, but expected to contain {} of them'.format( host.name, len(errata['results']), expected_amount if not None else 'No expected_amount provided', @@ -400,7 +399,7 @@ def package_applicability_changed_as_expected( output = host.execute(f'rpm -q {package_basename}').stdout current_package = output[:-1] assert package_basename in current_package - if current_package == package_filename: + if current_package == package_filename: # noqa: SIM108 # we have already checked if applicable package count changed, # in case the same version as prior was installed and present. prior_package = None # package must not have been present before this modification @@ -495,13 +494,16 @@ def _publish_and_wait(sat, org, cv, search_rate=1, max_tries=10): task_id = sat.api.ContentView(id=cv.id).publish({'id': cv.id, 'organization': org})['id'] assert task_id, f'No task was invoked to publish the Content-View: {cv.id}.' # Should take < 1 minute, check in 5s intervals - sat.wait_for_tasks( - search_query=(f'label = Actions::Katello::ContentView::Publish and id = {task_id}'), - search_rate=search_rate, - max_tries=max_tries, - ), ( - f'Failed to publish the Content-View: {cv.id}, in time.' - f'Task: {task_id} failed, or timed out ({search_rate*max_tries}s).' + ( + sat.wait_for_tasks( + search_query=(f'label = Actions::Katello::ContentView::Publish and id = {task_id}'), + search_rate=search_rate, + max_tries=max_tries, + ), + ( + f'Failed to publish the Content-View: {cv.id}, in time.' + f'Task: {task_id} failed, or timed out ({search_rate*max_tries}s).' + ), ) @@ -623,13 +625,16 @@ def test_positive_install_in_hc( 'organization_id': module_sca_manifest_org.id, }, )['id'] - target_sat.wait_for_tasks( - search_query=(f'label = Actions::RemoteExecution::RunHostsJob and id = {task_id}'), - search_rate=15, - max_tries=10, - ), ( - f'Could not install erratum: {CUSTOM_REPO_ERRATA_ID}, to Host-Collection.' - f' Task: {task_id} failed, or timed out.' + ( + target_sat.wait_for_tasks( + search_query=(f'label = Actions::RemoteExecution::RunHostsJob and id = {task_id}'), + search_rate=15, + max_tries=10, + ), + ( + f'Could not install erratum: {CUSTOM_REPO_ERRATA_ID}, to Host-Collection.' + f' Task: {task_id} failed, or timed out.' + ), ) for client in content_hosts: # No applicable errata after install on all clients @@ -928,8 +933,8 @@ def test_positive_install_multiple_in_host( f' but installed {len(updated_packages)}.' ) # Check sets of installed package filename(s) strings, matches expected - assert set(updated_packages) == set( - security_packages_to_install + assert ( + set(updated_packages) == set(security_packages_to_install) ), 'Expected package version filename(s) and installed package version filenam(s) are not the same.' diff --git a/tests/foreman/api/test_filter.py b/tests/foreman/api/test_filter.py index d13d5a7ecad..b676a67c6da 100644 --- a/tests/foreman/api/test_filter.py +++ b/tests/foreman/api/test_filter.py @@ -15,6 +15,7 @@ :CaseImportance: High """ + import pytest from requests.exceptions import HTTPError diff --git a/tests/foreman/api/test_foremantask.py b/tests/foreman/api/test_foremantask.py index c736a0e7161..0cab1253369 100644 --- a/tests/foreman/api/test_foremantask.py +++ b/tests/foreman/api/test_foremantask.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from requests.exceptions import HTTPError diff --git a/tests/foreman/api/test_host.py b/tests/foreman/api/test_host.py index eb3e89dc6aa..e8982215ad7 100644 --- a/tests/foreman/api/test_host.py +++ b/tests/foreman/api/test_host.py @@ -15,6 +15,7 @@ :CaseImportance: High """ + import http from fauxfactory import gen_choice, gen_integer, gen_ipaddr, gen_mac, gen_string diff --git a/tests/foreman/api/test_hostcollection.py b/tests/foreman/api/test_hostcollection.py index 985f989718e..3675b7a40b0 100644 --- a/tests/foreman/api/test_hostcollection.py +++ b/tests/foreman/api/test_hostcollection.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from random import choice, randint from broker import Broker diff --git a/tests/foreman/api/test_hostgroup.py b/tests/foreman/api/test_hostgroup.py index e0e6fd9ed91..5313ec0400f 100644 --- a/tests/foreman/api/test_hostgroup.py +++ b/tests/foreman/api/test_hostgroup.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from random import randint from fauxfactory import gen_string diff --git a/tests/foreman/api/test_http_proxy.py b/tests/foreman/api/test_http_proxy.py index 51ceb485361..04d12a2df2b 100644 --- a/tests/foreman/api/test_http_proxy.py +++ b/tests/foreman/api/test_http_proxy.py @@ -11,6 +11,7 @@ :CaseAutomation: Automated """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/api/test_ldapauthsource.py b/tests/foreman/api/test_ldapauthsource.py index 885d290e741..09742a8ff8d 100644 --- a/tests/foreman/api/test_ldapauthsource.py +++ b/tests/foreman/api/test_ldapauthsource.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from requests.exceptions import HTTPError diff --git a/tests/foreman/api/test_lifecycleenvironment.py b/tests/foreman/api/test_lifecycleenvironment.py index b68017efb87..61ec1a69a02 100644 --- a/tests/foreman/api/test_lifecycleenvironment.py +++ b/tests/foreman/api/test_lifecycleenvironment.py @@ -15,6 +15,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest from requests.exceptions import HTTPError diff --git a/tests/foreman/api/test_location.py b/tests/foreman/api/test_location.py index 2e54a4862fa..28c2d9c0b25 100644 --- a/tests/foreman/api/test_location.py +++ b/tests/foreman/api/test_location.py @@ -14,6 +14,7 @@ :CaseImportance: High """ + from random import randint from fauxfactory import gen_integer, gen_string diff --git a/tests/foreman/api/test_media.py b/tests/foreman/api/test_media.py index 79c5cb7f20e..f58f7982176 100644 --- a/tests/foreman/api/test_media.py +++ b/tests/foreman/api/test_media.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from fauxfactory import gen_string, gen_url @@ -38,7 +39,7 @@ def class_media(self, module_org, class_target_sat): ('name', 'new_name'), **parametrized( list(zip(valid_data_list().values(), valid_data_list().values(), strict=True)) - ) + ), ) def test_positive_crud_with_name(self, module_org, name, new_name, module_target_sat): """Create, update, delete media with valid name only diff --git a/tests/foreman/api/test_multiple_paths.py b/tests/foreman/api/test_multiple_paths.py index 8c683ca309a..b179e487fb7 100644 --- a/tests/foreman/api/test_multiple_paths.py +++ b/tests/foreman/api/test_multiple_paths.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import http from nailgun import client, entities, entity_fields diff --git a/tests/foreman/api/test_notifications.py b/tests/foreman/api/test_notifications.py index f2477ad3291..506a7983c16 100644 --- a/tests/foreman/api/test_notifications.py +++ b/tests/foreman/api/test_notifications.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from mailbox import mbox from re import findall from tempfile import mkstemp @@ -231,7 +232,7 @@ def long_running_task(target_sat): 'password': settings.server.ssh_password, }, ) - sql_date_2_days_ago = "now() - INTERVAL \'2 days\'" + sql_date_2_days_ago = "now() - INTERVAL \'2 days\'" # fmt: skip result = target_sat.execute( "su - postgres -c \"psql foreman postgres <> {0}'''.format( - HAMMER_CONFIG, 'true' if enable else 'false' - ) + echo ' :use_sessions: {1}' >> {0}'''.format(HAMMER_CONFIG, 'true' if enable else 'false') ) if result.status == 0 and add_default_creds: result = satellite.execute( diff --git a/tests/foreman/cli/test_bootdisk.py b/tests/foreman/cli/test_bootdisk.py index 5e0ca29eec6..7d9cf6ce70a 100644 --- a/tests/foreman/cli/test_bootdisk.py +++ b/tests/foreman/cli/test_bootdisk.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_mac, gen_string import pytest diff --git a/tests/foreman/cli/test_bootstrap_script.py b/tests/foreman/cli/test_bootstrap_script.py index f4b71c24bd1..65872032d1d 100644 --- a/tests/foreman/cli/test_bootstrap_script.py +++ b/tests/foreman/cli/test_bootstrap_script.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest diff --git a/tests/foreman/cli/test_capsule.py b/tests/foreman/cli/test_capsule.py index ddcc100326a..3f7e98b104d 100644 --- a/tests/foreman/cli/test_capsule.py +++ b/tests/foreman/cli/test_capsule.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest pytestmark = [pytest.mark.run_in_one_thread] diff --git a/tests/foreman/cli/test_capsulecontent.py b/tests/foreman/cli/test_capsulecontent.py index 73e42659fa2..a75ffbb1aed 100644 --- a/tests/foreman/cli/test_capsulecontent.py +++ b/tests/foreman/cli/test_capsulecontent.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/cli/test_classparameters.py b/tests/foreman/cli/test_classparameters.py index 022ceed0aac..f6b0ca7a4ee 100644 --- a/tests/foreman/cli/test_classparameters.py +++ b/tests/foreman/cli/test_classparameters.py @@ -11,6 +11,7 @@ :Team: Rocket """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/cli/test_computeresource_azurerm.py b/tests/foreman/cli/test_computeresource_azurerm.py index 1756a0ed674..1c64a55c5bc 100644 --- a/tests/foreman/cli/test_computeresource_azurerm.py +++ b/tests/foreman/cli/test_computeresource_azurerm.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest @@ -343,8 +344,9 @@ def class_host_ft( Provisions the host on AzureRM using Finish template Later in tests this host will be used to perform assertions """ - with sat_azure.hammer_api_timeout(), sat_azure.skip_yum_update_during_provisioning( - template='Kickstart default finish' + with ( + sat_azure.hammer_api_timeout(), + sat_azure.skip_yum_update_during_provisioning(template='Kickstart default finish'), ): host = sat_azure.cli.Host.create( { @@ -472,8 +474,9 @@ def class_host_ud( Provisions the host on AzureRM using UserData template Later in tests this host will be used to perform assertions """ - with sat_azure.hammer_api_timeout(), sat_azure.skip_yum_update_during_provisioning( - template='Kickstart default user data' + with ( + sat_azure.hammer_api_timeout(), + sat_azure.skip_yum_update_during_provisioning(template='Kickstart default user data'), ): host = sat_azure.cli.Host.create( { diff --git a/tests/foreman/cli/test_computeresource_ec2.py b/tests/foreman/cli/test_computeresource_ec2.py index e4e1e669e6b..36c128bdee0 100644 --- a/tests/foreman/cli/test_computeresource_ec2.py +++ b/tests/foreman/cli/test_computeresource_ec2.py @@ -8,6 +8,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/cli/test_computeresource_libvirt.py b/tests/foreman/cli/test_computeresource_libvirt.py index 2a4720750a0..656a8ed32ca 100644 --- a/tests/foreman/cli/test_computeresource_libvirt.py +++ b/tests/foreman/cli/test_computeresource_libvirt.py @@ -28,6 +28,7 @@ :CaseImportance: High """ + import random from fauxfactory import gen_string, gen_url diff --git a/tests/foreman/cli/test_computeresource_osp.py b/tests/foreman/cli/test_computeresource_osp.py index ff6779056ae..1b80cae877f 100644 --- a/tests/foreman/cli/test_computeresource_osp.py +++ b/tests/foreman/cli/test_computeresource_osp.py @@ -10,6 +10,7 @@ :CaseImportance: High """ + from box import Box from fauxfactory import gen_string import pytest diff --git a/tests/foreman/cli/test_computeresource_rhev.py b/tests/foreman/cli/test_computeresource_rhev.py index 173b9c1c414..9e93125eb6b 100644 --- a/tests/foreman/cli/test_computeresource_rhev.py +++ b/tests/foreman/cli/test_computeresource_rhev.py @@ -10,6 +10,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest from wait_for import wait_for diff --git a/tests/foreman/cli/test_computeresource_vmware.py b/tests/foreman/cli/test_computeresource_vmware.py index 62ee4a71505..da69418eecd 100644 --- a/tests/foreman/cli/test_computeresource_vmware.py +++ b/tests/foreman/cli/test_computeresource_vmware.py @@ -10,6 +10,7 @@ :CaseAutomation: Automated """ + from fauxfactory import gen_string import pytest from wait_for import wait_for diff --git a/tests/foreman/cli/test_container_management.py b/tests/foreman/cli/test_container_management.py index 17d0b0b4bd0..871993090ed 100644 --- a/tests/foreman/cli/test_container_management.py +++ b/tests/foreman/cli/test_container_management.py @@ -9,6 +9,7 @@ :CaseComponent: ContainerManagement-Content """ + from fauxfactory import gen_string import pytest from wait_for import wait_for diff --git a/tests/foreman/cli/test_contentaccess.py b/tests/foreman/cli/test_contentaccess.py index 0c59e5c70e6..5eefd3af5b0 100644 --- a/tests/foreman/cli/test_contentaccess.py +++ b/tests/foreman/cli/test_contentaccess.py @@ -9,6 +9,7 @@ :team: Phoenix-subscriptions """ + import time from nailgun import entities diff --git a/tests/foreman/cli/test_contentcredentials.py b/tests/foreman/cli/test_contentcredentials.py index 208812cb857..14d4ff50718 100644 --- a/tests/foreman/cli/test_contentcredentials.py +++ b/tests/foreman/cli/test_contentcredentials.py @@ -13,6 +13,7 @@ :CaseImportance: High """ + from tempfile import mkstemp from fauxfactory import gen_alphanumeric, gen_choice, gen_integer, gen_string diff --git a/tests/foreman/cli/test_contentview.py b/tests/foreman/cli/test_contentview.py index c2de286b9f6..33a18149335 100644 --- a/tests/foreman/cli/test_contentview.py +++ b/tests/foreman/cli/test_contentview.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from fauxfactory import gen_alphanumeric, gen_string diff --git a/tests/foreman/cli/test_contentviewfilter.py b/tests/foreman/cli/test_contentviewfilter.py index 65ffeb940a5..0a198b2754c 100644 --- a/tests/foreman/cli/test_contentviewfilter.py +++ b/tests/foreman/cli/test_contentviewfilter.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from fauxfactory import gen_string diff --git a/tests/foreman/cli/test_discoveredhost.py b/tests/foreman/cli/test_discoveredhost.py index e578f35e1ac..4c81335e2af 100644 --- a/tests/foreman/cli/test_discoveredhost.py +++ b/tests/foreman/cli/test_discoveredhost.py @@ -9,6 +9,7 @@ :Team: Rocket """ + import pytest from wait_for import wait_for diff --git a/tests/foreman/cli/test_discoveryrule.py b/tests/foreman/cli/test_discoveryrule.py index 2d9059f196b..933b68538aa 100644 --- a/tests/foreman/cli/test_discoveryrule.py +++ b/tests/foreman/cli/test_discoveryrule.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from functools import partial import random diff --git a/tests/foreman/cli/test_docker.py b/tests/foreman/cli/test_docker.py index 10b1d1dd4fc..30f96d9212b 100644 --- a/tests/foreman/cli/test_docker.py +++ b/tests/foreman/cli/test_docker.py @@ -7,6 +7,7 @@ :CaseImportance: High """ + from random import choice, randint from fauxfactory import gen_string, gen_url diff --git a/tests/foreman/cli/test_domain.py b/tests/foreman/cli/test_domain.py index 32f81369592..d77829e3039 100644 --- a/tests/foreman/cli/test_domain.py +++ b/tests/foreman/cli/test_domain.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/cli/test_environment.py b/tests/foreman/cli/test_environment.py index 90e5b79e72a..422030f6af4 100644 --- a/tests/foreman/cli/test_environment.py +++ b/tests/foreman/cli/test_environment.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + from random import choice from fauxfactory import gen_alphanumeric, gen_string diff --git a/tests/foreman/cli/test_errata.py b/tests/foreman/cli/test_errata.py index 0dc3e091654..881f95a1c7e 100644 --- a/tests/foreman/cli/test_errata.py +++ b/tests/foreman/cli/test_errata.py @@ -10,6 +10,7 @@ :CaseImportance: High """ + from datetime import date, datetime, timedelta from operator import itemgetter import re diff --git a/tests/foreman/cli/test_fact.py b/tests/foreman/cli/test_fact.py index ddaaa477944..7913d68287c 100644 --- a/tests/foreman/cli/test_fact.py +++ b/tests/foreman/cli/test_fact.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/cli/test_filter.py b/tests/foreman/cli/test_filter.py index 4108ce07d6b..3f05953d6ce 100644 --- a/tests/foreman/cli/test_filter.py +++ b/tests/foreman/cli/test_filter.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.exceptions import CLIReturnCodeError diff --git a/tests/foreman/cli/test_foremantask.py b/tests/foreman/cli/test_foremantask.py index bdce6e63a97..da49b88a289 100644 --- a/tests/foreman/cli/test_foremantask.py +++ b/tests/foreman/cli/test_foremantask.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest diff --git a/tests/foreman/cli/test_globalparam.py b/tests/foreman/cli/test_globalparam.py index 41bb8ca769b..6c1eaed9c07 100644 --- a/tests/foreman/cli/test_globalparam.py +++ b/tests/foreman/cli/test_globalparam.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + from functools import partial from fauxfactory import gen_string diff --git a/tests/foreman/cli/test_hammer.py b/tests/foreman/cli/test_hammer.py index aa3bfcf4aeb..bc78daa88c0 100644 --- a/tests/foreman/cli/test_hammer.py +++ b/tests/foreman/cli/test_hammer.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import io import json import re diff --git a/tests/foreman/cli/test_host.py b/tests/foreman/cli/test_host.py index cb2b75362d7..f15cfbc6de5 100644 --- a/tests/foreman/cli/test_host.py +++ b/tests/foreman/cli/test_host.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from random import choice import re diff --git a/tests/foreman/cli/test_hostcollection.py b/tests/foreman/cli/test_hostcollection.py index ce3426030b5..e01238e440b 100644 --- a/tests/foreman/cli/test_hostcollection.py +++ b/tests/foreman/cli/test_hostcollection.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from broker import Broker from fauxfactory import gen_string import pytest diff --git a/tests/foreman/cli/test_hostgroup.py b/tests/foreman/cli/test_hostgroup.py index febe94038f8..dee6662a950 100644 --- a/tests/foreman/cli/test_hostgroup.py +++ b/tests/foreman/cli/test_hostgroup.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_integer from nailgun import entities import pytest diff --git a/tests/foreman/cli/test_http_proxy.py b/tests/foreman/cli/test_http_proxy.py index 68ea95559ca..bc7e07b0cd1 100644 --- a/tests/foreman/cli/test_http_proxy.py +++ b/tests/foreman/cli/test_http_proxy.py @@ -11,6 +11,7 @@ :CaseAutomation: Automated """ + from fauxfactory import gen_integer, gen_string, gen_url import pytest diff --git a/tests/foreman/cli/test_installer.py b/tests/foreman/cli/test_installer.py index cf0eb838ee0..a31ad211237 100644 --- a/tests/foreman/cli/test_installer.py +++ b/tests/foreman/cli/test_installer.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest pytestmark = [pytest.mark.stubbed] diff --git a/tests/foreman/cli/test_jobtemplate.py b/tests/foreman/cli/test_jobtemplate.py index 66553d2c54d..8fb80120384 100644 --- a/tests/foreman/cli/test_jobtemplate.py +++ b/tests/foreman/cli/test_jobtemplate.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/cli/test_ldapauthsource.py b/tests/foreman/cli/test_ldapauthsource.py index e3cb8bb32ab..f87695dd587 100644 --- a/tests/foreman/cli/test_ldapauthsource.py +++ b/tests/foreman/cli/test_ldapauthsource.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string from nailgun import entities import pytest @@ -113,7 +114,7 @@ def test_positive_refresh_usergroup_with_ad(self, member_group, ad_data, module_ 'attr-firstname': LDAP_ATTR['firstname'], 'attr-lastname': LDAP_ATTR['surname'], 'attr-mail': LDAP_ATTR['mail'], - 'account': fr"{ad_data['workgroup']}\{ad_data['ldap_user_name']}", + 'account': rf"{ad_data['workgroup']}\{ad_data['ldap_user_name']}", 'account-password': ad_data['ldap_user_passwd'], 'base-dn': ad_data['base_dn'], } diff --git a/tests/foreman/cli/test_leapp_client.py b/tests/foreman/cli/test_leapp_client.py index a05b3db20ec..ff21a28837a 100644 --- a/tests/foreman/cli/test_leapp_client.py +++ b/tests/foreman/cli/test_leapp_client.py @@ -11,6 +11,7 @@ :CaseAutomation: Automated """ + from broker import Broker from fauxfactory import gen_string import pytest diff --git a/tests/foreman/cli/test_lifecycleenvironment.py b/tests/foreman/cli/test_lifecycleenvironment.py index 75bf12c681b..294753e04e8 100644 --- a/tests/foreman/cli/test_lifecycleenvironment.py +++ b/tests/foreman/cli/test_lifecycleenvironment.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from math import ceil from fauxfactory import gen_string diff --git a/tests/foreman/cli/test_location.py b/tests/foreman/cli/test_location.py index 9f835c1c581..eff9220f149 100644 --- a/tests/foreman/cli/test_location.py +++ b/tests/foreman/cli/test_location.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/cli/test_logging.py b/tests/foreman/cli/test_logging.py index 8d315b3e59c..620f2f0cceb 100644 --- a/tests/foreman/cli/test_logging.py +++ b/tests/foreman/cli/test_logging.py @@ -11,6 +11,7 @@ :CaseImportance: Medium """ + import re from fauxfactory import gen_string @@ -243,7 +244,7 @@ def test_positive_logging_from_pulp3(module_org, target_sat): target_sat.cli.Repository.synchronize({'id': repo['id']}) # Get the id of repository sync from task task_out = target_sat.execute( - "hammer task list | grep -F \'Synchronize repository {\"text\"=>\"repository\'" + "hammer task list | grep -F 'Synchronize repository {\"text\"=>\"repository'" ).stdout.splitlines()[0][:8] prod_log_out = target_sat.execute(f'grep {task_out} {source_log}').stdout.splitlines()[0] # Get correlation id of pulp from production logs diff --git a/tests/foreman/cli/test_medium.py b/tests/foreman/cli/test_medium.py index 26017b415ab..3e3b037ba2d 100644 --- a/tests/foreman/cli/test_medium.py +++ b/tests/foreman/cli/test_medium.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_alphanumeric import pytest diff --git a/tests/foreman/cli/test_model.py b/tests/foreman/cli/test_model.py index 8fc51be9f62..f60a6c59fc6 100644 --- a/tests/foreman/cli/test_model.py +++ b/tests/foreman/cli/test_model.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest @@ -37,7 +38,7 @@ def class_model(self, target_sat): ('name', 'new_name'), **parametrized( list(zip(valid_data_list().values(), valid_data_list().values(), strict=True)) - ) + ), ) def test_positive_crud_with_name(self, name, new_name, module_target_sat): """Successfully creates, updates and deletes a Model. diff --git a/tests/foreman/cli/test_operatingsystem.py b/tests/foreman/cli/test_operatingsystem.py index 48ed8af8099..615ffb9990f 100644 --- a/tests/foreman/cli/test_operatingsystem.py +++ b/tests/foreman/cli/test_operatingsystem.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_alphanumeric, gen_string import pytest diff --git a/tests/foreman/cli/test_organization.py b/tests/foreman/cli/test_organization.py index da79144f141..eded57e07ef 100644 --- a/tests/foreman/cli/test_organization.py +++ b/tests/foreman/cli/test_organization.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/cli/test_oscap.py b/tests/foreman/cli/test_oscap.py index c198e5fa636..09b3d1c9546 100644 --- a/tests/foreman/cli/test_oscap.py +++ b/tests/foreman/cli/test_oscap.py @@ -11,6 +11,7 @@ :CaseAutomation: Automated """ + from fauxfactory import gen_string from nailgun import entities import pytest diff --git a/tests/foreman/cli/test_oscap_tailoringfiles.py b/tests/foreman/cli/test_oscap_tailoringfiles.py index e95cfb2891a..127ba051e40 100644 --- a/tests/foreman/cli/test_oscap_tailoringfiles.py +++ b/tests/foreman/cli/test_oscap_tailoringfiles.py @@ -11,6 +11,7 @@ :CaseAutomation: Automated """ + from fauxfactory import gen_string import pytest @@ -185,7 +186,6 @@ def test_negative_associate_tailoring_file_with_different_scap(self): @pytest.mark.skip_if_open("BZ:1857572") @pytest.mark.tier2 def test_positive_download_tailoring_file(self, tailoring_file_path, target_sat): - """Download the tailoring file from satellite :id: 75d8c810-19a7-4285-bc3a-a1fb1a0e9088 diff --git a/tests/foreman/cli/test_ostreebranch.py b/tests/foreman/cli/test_ostreebranch.py index d768b3f2d70..0d885528a04 100644 --- a/tests/foreman/cli/test_ostreebranch.py +++ b/tests/foreman/cli/test_ostreebranch.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from nailgun import entities diff --git a/tests/foreman/cli/test_partitiontable.py b/tests/foreman/cli/test_partitiontable.py index 51764ac8f0a..e89af27e163 100644 --- a/tests/foreman/cli/test_partitiontable.py +++ b/tests/foreman/cli/test_partitiontable.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from random import randint from fauxfactory import gen_string diff --git a/tests/foreman/cli/test_ping.py b/tests/foreman/cli/test_ping.py index 1036b3c5fd9..0d6b6929c25 100644 --- a/tests/foreman/cli/test_ping.py +++ b/tests/foreman/cli/test_ping.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest pytestmark = [pytest.mark.tier1, pytest.mark.upgrade] diff --git a/tests/foreman/cli/test_product.py b/tests/foreman/cli/test_product.py index 3d413209db3..ec81348a850 100644 --- a/tests/foreman/cli/test_product.py +++ b/tests/foreman/cli/test_product.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_alphanumeric, gen_integer, gen_string, gen_url import pytest diff --git a/tests/foreman/cli/test_provisioning.py b/tests/foreman/cli/test_provisioning.py index 1c7799edc53..21f937dac24 100644 --- a/tests/foreman/cli/test_provisioning.py +++ b/tests/foreman/cli/test_provisioning.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest diff --git a/tests/foreman/cli/test_provisioningtemplate.py b/tests/foreman/cli/test_provisioningtemplate.py index 59aabc2d2c4..a27b6fe534d 100644 --- a/tests/foreman/cli/test_provisioningtemplate.py +++ b/tests/foreman/cli/test_provisioningtemplate.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from random import randint diff --git a/tests/foreman/cli/test_puppetclass.py b/tests/foreman/cli/test_puppetclass.py index 3a8b50856bb..a3dcd8837f9 100644 --- a/tests/foreman/cli/test_puppetclass.py +++ b/tests/foreman/cli/test_puppetclass.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/cli/test_realm.py b/tests/foreman/cli/test_realm.py index e6480abd3a7..7250fb4f0c2 100644 --- a/tests/foreman/cli/test_realm.py +++ b/tests/foreman/cli/test_realm.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from fauxfactory import gen_string diff --git a/tests/foreman/cli/test_registration.py b/tests/foreman/cli/test_registration.py index 0d2c6488314..adf275eb06c 100644 --- a/tests/foreman/cli/test_registration.py +++ b/tests/foreman/cli/test_registration.py @@ -11,6 +11,7 @@ :Team: Rocket """ + import json import re from tempfile import mkstemp diff --git a/tests/foreman/cli/test_remoteexecution.py b/tests/foreman/cli/test_remoteexecution.py index fc5d5f3fb81..c486e4eec3a 100644 --- a/tests/foreman/cli/test_remoteexecution.py +++ b/tests/foreman/cli/test_remoteexecution.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from calendar import monthrange from datetime import datetime, timedelta import random diff --git a/tests/foreman/cli/test_report.py b/tests/foreman/cli/test_report.py index ea4f14371bb..588346f9431 100644 --- a/tests/foreman/cli/test_report.py +++ b/tests/foreman/cli/test_report.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import random import pytest diff --git a/tests/foreman/cli/test_reporttemplates.py b/tests/foreman/cli/test_reporttemplates.py index 9c9bcf0e5a6..b1a92d67049 100644 --- a/tests/foreman/cli/test_reporttemplates.py +++ b/tests/foreman/cli/test_reporttemplates.py @@ -10,6 +10,7 @@ :CaseImportance: High """ + from broker import Broker from fauxfactory import gen_alpha import pytest diff --git a/tests/foreman/cli/test_repositories.py b/tests/foreman/cli/test_repositories.py index fdbe9948b09..f7f4fdafdb9 100644 --- a/tests/foreman/cli/test_repositories.py +++ b/tests/foreman/cli/test_repositories.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest from requests.exceptions import HTTPError diff --git a/tests/foreman/cli/test_repository.py b/tests/foreman/cli/test_repository.py index 6d612029d15..9d3bad40467 100644 --- a/tests/foreman/cli/test_repository.py +++ b/tests/foreman/cli/test_repository.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from random import choice from string import punctuation diff --git a/tests/foreman/cli/test_repository_set.py b/tests/foreman/cli/test_repository_set.py index 092034c6dc8..71d7d091493 100644 --- a/tests/foreman/cli/test_repository_set.py +++ b/tests/foreman/cli/test_repository_set.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.constants import PRDS, REPOSET diff --git a/tests/foreman/cli/test_rhcloud_inventory.py b/tests/foreman/cli/test_rhcloud_inventory.py index ed84fd465d7..d8fbb53adbf 100644 --- a/tests/foreman/cli/test_rhcloud_inventory.py +++ b/tests/foreman/cli/test_rhcloud_inventory.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime import time diff --git a/tests/foreman/cli/test_role.py b/tests/foreman/cli/test_role.py index 7ccdafdf4f1..6e16e0f0759 100644 --- a/tests/foreman/cli/test_role.py +++ b/tests/foreman/cli/test_role.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from math import ceil from random import choice import re diff --git a/tests/foreman/cli/test_satellitesync.py b/tests/foreman/cli/test_satellitesync.py index 09ff7391a22..2884fbfea49 100644 --- a/tests/foreman/cli/test_satellitesync.py +++ b/tests/foreman/cli/test_satellitesync.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import os from time import sleep diff --git a/tests/foreman/cli/test_settings.py b/tests/foreman/cli/test_settings.py index fdd005e02e8..3c8f37461cb 100644 --- a/tests/foreman/cli/test_settings.py +++ b/tests/foreman/cli/test_settings.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from time import sleep diff --git a/tests/foreman/cli/test_sso.py b/tests/foreman/cli/test_sso.py index 949e021ff48..e24b847ed73 100644 --- a/tests/foreman/cli/test_sso.py +++ b/tests/foreman/cli/test_sso.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest pytestmark = [pytest.mark.stubbed, pytest.mark.upgrade] diff --git a/tests/foreman/cli/test_subnet.py b/tests/foreman/cli/test_subnet.py index 74a6e1727fc..c7daca3bb27 100644 --- a/tests/foreman/cli/test_subnet.py +++ b/tests/foreman/cli/test_subnet.py @@ -11,6 +11,7 @@ :CaseImportance: Medium """ + import random import re diff --git a/tests/foreman/cli/test_subscription.py b/tests/foreman/cli/test_subscription.py index 5174a046635..c47d419c41a 100644 --- a/tests/foreman/cli/test_subscription.py +++ b/tests/foreman/cli/test_subscription.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string from manifester import Manifester from nailgun import entities diff --git a/tests/foreman/cli/test_syncplan.py b/tests/foreman/cli/test_syncplan.py index 8669cd49a18..4569fd5aa61 100644 --- a/tests/foreman/cli/test_syncplan.py +++ b/tests/foreman/cli/test_syncplan.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime, timedelta from time import sleep diff --git a/tests/foreman/cli/test_templatesync.py b/tests/foreman/cli/test_templatesync.py index b0cc31b2003..4d8aa850373 100644 --- a/tests/foreman/cli/test_templatesync.py +++ b/tests/foreman/cli/test_templatesync.py @@ -9,6 +9,7 @@ :Team: Endeavour """ + import base64 from fauxfactory import gen_string diff --git a/tests/foreman/cli/test_user.py b/tests/foreman/cli/test_user.py index 3646e301db0..8b9c2b97147 100644 --- a/tests/foreman/cli/test_user.py +++ b/tests/foreman/cli/test_user.py @@ -17,6 +17,7 @@ :CaseImportance: High """ + import datetime import random from time import sleep diff --git a/tests/foreman/cli/test_usergroup.py b/tests/foreman/cli/test_usergroup.py index 1c757b4e766..5ad9106a6fc 100644 --- a/tests/foreman/cli/test_usergroup.py +++ b/tests/foreman/cli/test_usergroup.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random import pytest diff --git a/tests/foreman/cli/test_vm_install_products_package.py b/tests/foreman/cli/test_vm_install_products_package.py index eb5a38a09f0..3443efb2bc8 100644 --- a/tests/foreman/cli/test_vm_install_products_package.py +++ b/tests/foreman/cli/test_vm_install_products_package.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from broker import Broker import pytest diff --git a/tests/foreman/cli/test_webhook.py b/tests/foreman/cli/test_webhook.py index 2849b6aa57d..b981f01f8b1 100644 --- a/tests/foreman/cli/test_webhook.py +++ b/tests/foreman/cli/test_webhook.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from functools import partial from random import choice diff --git a/tests/foreman/destructive/test_ansible.py b/tests/foreman/destructive/test_ansible.py index b57ba89c58f..28f6e932099 100644 --- a/tests/foreman/destructive/test_ansible.py +++ b/tests/foreman/destructive/test_ansible.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest pytestmark = [pytest.mark.destructive, pytest.mark.upgrade] diff --git a/tests/foreman/destructive/test_auth.py b/tests/foreman/destructive/test_auth.py index 06a59097434..cf218def68e 100644 --- a/tests/foreman/destructive/test_auth.py +++ b/tests/foreman/destructive/test_auth.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/destructive/test_capsule.py b/tests/foreman/destructive/test_capsule.py index 1cc63f4fbbe..9d3ce22b420 100644 --- a/tests/foreman/destructive/test_capsule.py +++ b/tests/foreman/destructive/test_capsule.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/destructive/test_capsule_loadbalancer.py b/tests/foreman/destructive/test_capsule_loadbalancer.py index cf36aac8a9f..f9b3bbbf8d7 100644 --- a/tests/foreman/destructive/test_capsule_loadbalancer.py +++ b/tests/foreman/destructive/test_capsule_loadbalancer.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from wrapanapi import VmState diff --git a/tests/foreman/destructive/test_capsulecontent.py b/tests/foreman/destructive/test_capsulecontent.py index 12f3455c08d..d165b6ea841 100644 --- a/tests/foreman/destructive/test_capsulecontent.py +++ b/tests/foreman/destructive/test_capsulecontent.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from box import Box from fauxfactory import gen_alpha import pytest diff --git a/tests/foreman/destructive/test_clone.py b/tests/foreman/destructive/test_clone.py index fade8abcf6a..e7a772161a9 100644 --- a/tests/foreman/destructive/test_clone.py +++ b/tests/foreman/destructive/test_clone.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo import constants diff --git a/tests/foreman/destructive/test_contenthost.py b/tests/foreman/destructive/test_contenthost.py index bf3b0264d2c..5e2061e89de 100644 --- a/tests/foreman/destructive/test_contenthost.py +++ b/tests/foreman/destructive/test_contenthost.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/destructive/test_contentview.py b/tests/foreman/destructive/test_contentview.py index d6b39f7556b..6e7f48d8fc8 100644 --- a/tests/foreman/destructive/test_contentview.py +++ b/tests/foreman/destructive/test_contentview.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from time import sleep diff --git a/tests/foreman/destructive/test_discoveredhost.py b/tests/foreman/destructive/test_discoveredhost.py index 8034957ec72..86568230e0d 100644 --- a/tests/foreman/destructive/test_discoveredhost.py +++ b/tests/foreman/destructive/test_discoveredhost.py @@ -9,6 +9,7 @@ :CaseAutomation: Automated """ + from copy import copy import re diff --git a/tests/foreman/destructive/test_foreman_rake.py b/tests/foreman/destructive/test_foreman_rake.py index 5162fa94be2..1cbc67a7b20 100644 --- a/tests/foreman/destructive/test_foreman_rake.py +++ b/tests/foreman/destructive/test_foreman_rake.py @@ -11,6 +11,7 @@ :Team: Endeavour """ + import pytest pytestmark = pytest.mark.destructive diff --git a/tests/foreman/destructive/test_foreman_service.py b/tests/foreman/destructive/test_foreman_service.py index 6d0d24de110..fc033cd2965 100644 --- a/tests/foreman/destructive/test_foreman_service.py +++ b/tests/foreman/destructive/test_foreman_service.py @@ -7,6 +7,7 @@ :CaseImportance: Medium """ + import pytest from robottelo.constants import DEFAULT_ORG diff --git a/tests/foreman/destructive/test_host.py b/tests/foreman/destructive/test_host.py index bab00e5acab..4a8ae350f39 100644 --- a/tests/foreman/destructive/test_host.py +++ b/tests/foreman/destructive/test_host.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from airgun.exceptions import NoSuchElementException import pytest diff --git a/tests/foreman/destructive/test_infoblox.py b/tests/foreman/destructive/test_infoblox.py index cb3aad76c75..e3e7c3409cd 100644 --- a/tests/foreman/destructive/test_infoblox.py +++ b/tests/foreman/destructive/test_infoblox.py @@ -9,6 +9,7 @@ :CaseImportance: High """ + from fauxfactory import gen_mac, gen_string import pytest import requests diff --git a/tests/foreman/destructive/test_installer.py b/tests/foreman/destructive/test_installer.py index 36776213c13..8c61633fc53 100644 --- a/tests/foreman/destructive/test_installer.py +++ b/tests/foreman/destructive/test_installer.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import random from fauxfactory import gen_domain, gen_string diff --git a/tests/foreman/destructive/test_katello_certs_check.py b/tests/foreman/destructive/test_katello_certs_check.py index 01c41441823..34250be6e66 100644 --- a/tests/foreman/destructive/test_katello_certs_check.py +++ b/tests/foreman/destructive/test_katello_certs_check.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import re import pytest diff --git a/tests/foreman/destructive/test_ldap_authentication.py b/tests/foreman/destructive/test_ldap_authentication.py index 3a8468de3d0..050ae241d0f 100644 --- a/tests/foreman/destructive/test_ldap_authentication.py +++ b/tests/foreman/destructive/test_ldap_authentication.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import os from time import sleep @@ -196,9 +197,12 @@ def test_positive_create_with_https( assert ldap_source['ldap_server']['name'] == ldap_auth_name assert ldap_source['ldap_server']['host'] == auth_data['ldap_hostname'] assert ldap_source['ldap_server']['port'] == '636' - with module_target_sat.ui_session( - test_name, username, auth_data['ldap_user_passwd'] - ) as ldapsession, pytest.raises(NavigationTriesExceeded): + with ( + module_target_sat.ui_session( + test_name, username, auth_data['ldap_user_passwd'] + ) as ldapsession, + pytest.raises(NavigationTriesExceeded), + ): ldapsession.user.search('') assert module_target_sat.api.User().search(query={'search': f'login="{username}"'}) diff --git a/tests/foreman/destructive/test_ldapauthsource.py b/tests/foreman/destructive/test_ldapauthsource.py index 0cebd782532..1b6aeec2701 100644 --- a/tests/foreman/destructive/test_ldapauthsource.py +++ b/tests/foreman/destructive/test_ldapauthsource.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from time import sleep import pytest diff --git a/tests/foreman/destructive/test_leapp_satellite.py b/tests/foreman/destructive/test_leapp_satellite.py index 9022b4fec86..8d673b94645 100644 --- a/tests/foreman/destructive/test_leapp_satellite.py +++ b/tests/foreman/destructive/test_leapp_satellite.py @@ -9,6 +9,7 @@ :CaseImportance: High """ + from broker import Broker import pytest diff --git a/tests/foreman/destructive/test_packages.py b/tests/foreman/destructive/test_packages.py index da9c15f6515..c7098c98924 100644 --- a/tests/foreman/destructive/test_packages.py +++ b/tests/foreman/destructive/test_packages.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import re import pytest diff --git a/tests/foreman/destructive/test_ping.py b/tests/foreman/destructive/test_ping.py index 96ae171c8f7..145ce663be6 100644 --- a/tests/foreman/destructive/test_ping.py +++ b/tests/foreman/destructive/test_ping.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest pytestmark = pytest.mark.destructive diff --git a/tests/foreman/destructive/test_puppetplugin.py b/tests/foreman/destructive/test_puppetplugin.py index 9bd118ac4e7..3411f13000d 100644 --- a/tests/foreman/destructive/test_puppetplugin.py +++ b/tests/foreman/destructive/test_puppetplugin.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.constants import PUPPET_CAPSULE_INSTALLER, PUPPET_COMMON_INSTALLER_OPTS diff --git a/tests/foreman/destructive/test_realm.py b/tests/foreman/destructive/test_realm.py index cbddcdc3bc8..7ee6f519037 100644 --- a/tests/foreman/destructive/test_realm.py +++ b/tests/foreman/destructive/test_realm.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from fauxfactory import gen_string diff --git a/tests/foreman/destructive/test_registration.py b/tests/foreman/destructive/test_registration.py index 9c8dbfa4929..7b4aae79ebf 100644 --- a/tests/foreman/destructive/test_registration.py +++ b/tests/foreman/destructive/test_registration.py @@ -10,6 +10,7 @@ :Team: Rocket """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/destructive/test_remoteexecution.py b/tests/foreman/destructive/test_remoteexecution.py index c9c6bdb8b22..190708153a5 100644 --- a/tests/foreman/destructive/test_remoteexecution.py +++ b/tests/foreman/destructive/test_remoteexecution.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string from nailgun import client from nailgun.entity_mixins import TaskFailedError diff --git a/tests/foreman/destructive/test_rename.py b/tests/foreman/destructive/test_rename.py index 03fd9ff0d6f..8f06cd7a5f8 100644 --- a/tests/foreman/destructive/test_rename.py +++ b/tests/foreman/destructive/test_rename.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/destructive/test_repository.py b/tests/foreman/destructive/test_repository.py index 026134f2017..41c380df2ad 100644 --- a/tests/foreman/destructive/test_repository.py +++ b/tests/foreman/destructive/test_repository.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from nailgun.entity_mixins import TaskFailedError import pytest diff --git a/tests/foreman/endtoend/test_api_endtoend.py b/tests/foreman/endtoend/test_api_endtoend.py index e8bf062659c..2562afcc408 100644 --- a/tests/foreman/endtoend/test_api_endtoend.py +++ b/tests/foreman/endtoend/test_api_endtoend.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from collections import defaultdict import http from pprint import pformat diff --git a/tests/foreman/endtoend/test_cli_endtoend.py b/tests/foreman/endtoend/test_cli_endtoend.py index e14085f39a7..635b3da4f64 100644 --- a/tests/foreman/endtoend/test_cli_endtoend.py +++ b/tests/foreman/endtoend/test_cli_endtoend.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_alphanumeric, gen_ipaddr import pytest diff --git a/tests/foreman/installer/test_infoblox.py b/tests/foreman/installer/test_infoblox.py index 5f839d4e850..b17b3db02ab 100644 --- a/tests/foreman/installer/test_infoblox.py +++ b/tests/foreman/installer/test_infoblox.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest diff --git a/tests/foreman/installer/test_installer.py b/tests/foreman/installer/test_installer.py index e99b7f5cdbf..332fa370840 100644 --- a/tests/foreman/installer/test_installer.py +++ b/tests/foreman/installer/test_installer.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest import requests diff --git a/tests/foreman/longrun/test_inc_updates.py b/tests/foreman/longrun/test_inc_updates.py index 823eb97dcb4..52fd35e3b56 100644 --- a/tests/foreman/longrun/test_inc_updates.py +++ b/tests/foreman/longrun/test_inc_updates.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime, timedelta from nailgun import entities diff --git a/tests/foreman/longrun/test_oscap.py b/tests/foreman/longrun/test_oscap.py index 53777de356b..aaaa127a098 100644 --- a/tests/foreman/longrun/test_oscap.py +++ b/tests/foreman/longrun/test_oscap.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from broker import Broker from fauxfactory import gen_string from nailgun import entities diff --git a/tests/foreman/longrun/test_remoteexecution.py b/tests/foreman/longrun/test_remoteexecution.py index abff4966d7a..14c75f1cec7 100644 --- a/tests/foreman/longrun/test_remoteexecution.py +++ b/tests/foreman/longrun/test_remoteexecution.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest diff --git a/tests/foreman/maintain/test_advanced.py b/tests/foreman/maintain/test_advanced.py index 68b00e5c071..219a22d03da 100644 --- a/tests/foreman/maintain/test_advanced.py +++ b/tests/foreman/maintain/test_advanced.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest import yaml diff --git a/tests/foreman/maintain/test_backup_restore.py b/tests/foreman/maintain/test_backup_restore.py index f81b268e844..0e110b78f1b 100644 --- a/tests/foreman/maintain/test_backup_restore.py +++ b/tests/foreman/maintain/test_backup_restore.py @@ -12,6 +12,7 @@ """ + import re from fauxfactory import gen_string @@ -136,7 +137,7 @@ def test_positive_backup_split_pulp_tar( assert 'FAIL' not in result.stdout # Check for expected files - backup_dir = re.findall(fr'{subdir}\/{instance}-backup-.*-[0-5][0-9]', result.stdout)[0] + backup_dir = re.findall(rf'{subdir}\/{instance}-backup-.*-[0-5][0-9]', result.stdout)[0] files = sat_maintain.execute(f'ls -a {backup_dir}').stdout.split('\n') files = [i for i in files if not re.compile(r'^\.*$').search(i)] @@ -180,7 +181,7 @@ def test_positive_backup_capsule_features( assert 'FAIL' not in result.stdout # Check for expected files - backup_dir = re.findall(fr'{subdir}\/{instance}-backup-.*-[0-5][0-9]', result.stdout)[0] + backup_dir = re.findall(rf'{subdir}\/{instance}-backup-.*-[0-5][0-9]', result.stdout)[0] files = sat_maintain.execute(f'ls -a {backup_dir}').stdout.split('\n') files = [i for i in files if not re.compile(r'^\.*$').search(i)] @@ -215,7 +216,7 @@ def test_positive_backup_all(sat_maintain, setup_backup_tests, module_synced_rep assert result.status == 0 assert 'FAIL' not in result.stdout - init_backup_dir = re.findall(fr'{subdir}\/{instance}-backup-.*-[0-5][0-9]', result.stdout)[0] + init_backup_dir = re.findall(rf'{subdir}\/{instance}-backup-.*-[0-5][0-9]', result.stdout)[0] result = sat_maintain.cli.Backup.run_backup( backup_dir=subdir, @@ -262,7 +263,7 @@ def test_positive_backup_offline_logical(sat_maintain, setup_backup_tests, modul assert 'FAIL' not in result.stdout # Check for expected files - backup_dir = re.findall(fr'{subdir}\/{instance}-backup-.*-[0-5][0-9]', result.stdout)[0] + backup_dir = re.findall(rf'{subdir}\/{instance}-backup-.*-[0-5][0-9]', result.stdout)[0] files = sat_maintain.execute(f'ls -a {backup_dir}').stdout.split('\n') files = [i for i in files if not re.compile(r'^\.*$').search(i)] @@ -435,7 +436,7 @@ def test_positive_puppet_backup_restore( assert 'FAIL' not in result.stdout # Check for expected files - backup_dir = re.findall(fr'{subdir}\/{instance}-backup-.*-[0-5][0-9]', result.stdout)[0] + backup_dir = re.findall(rf'{subdir}\/{instance}-backup-.*-[0-5][0-9]', result.stdout)[0] files = sat_maintain.execute(f'ls -a {backup_dir}').stdout.split('\n') files = [i for i in files if not re.compile(r'^\.*$').search(i)] @@ -521,7 +522,7 @@ def test_positive_backup_restore( assert 'FAIL' not in result.stdout # Check for expected files - backup_dir = re.findall(fr'{subdir}\/{instance}-backup-.*-[0-5][0-9]', result.stdout)[0] + backup_dir = re.findall(rf'{subdir}\/{instance}-backup-.*-[0-5][0-9]', result.stdout)[0] files = sat_maintain.execute(f'ls -a {backup_dir}').stdout.split('\n') files = [i for i in files if not re.compile(r'^\.*$').search(i)] @@ -605,7 +606,7 @@ def test_positive_backup_restore_incremental( assert result.status == 0 assert 'FAIL' not in result.stdout - init_backup_dir = re.findall(fr'{subdir}\/satellite-backup-.*-[0-5][0-9]', result.stdout)[0] + init_backup_dir = re.findall(rf'{subdir}\/satellite-backup-.*-[0-5][0-9]', result.stdout)[0] # create additional content secondary_repo = sat_maintain.api.Repository( @@ -624,7 +625,7 @@ def test_positive_backup_restore_incremental( assert 'FAIL' not in result.stdout # check for expected files - inc_backup_dir = re.findall(fr'{subdir}\/satellite-backup-.*-[0-5][0-9]', result.stdout)[0] + inc_backup_dir = re.findall(rf'{subdir}\/satellite-backup-.*-[0-5][0-9]', result.stdout)[0] files = sat_maintain.execute(f'ls -a {inc_backup_dir}').stdout.split('\n') files = [i for i in files if not re.compile(r'^\.*$').search(i)] diff --git a/tests/foreman/maintain/test_health.py b/tests/foreman/maintain/test_health.py index 9ba117f72cf..b5bb4e6f511 100644 --- a/tests/foreman/maintain/test_health.py +++ b/tests/foreman/maintain/test_health.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import time from fauxfactory import gen_string diff --git a/tests/foreman/maintain/test_maintenance_mode.py b/tests/foreman/maintain/test_maintenance_mode.py index b8d5024e1b1..a405371d516 100644 --- a/tests/foreman/maintain/test_maintenance_mode.py +++ b/tests/foreman/maintain/test_maintenance_mode.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest import yaml diff --git a/tests/foreman/maintain/test_offload_DB.py b/tests/foreman/maintain/test_offload_DB.py index 0e1b3ced9d9..3c069658f98 100644 --- a/tests/foreman/maintain/test_offload_DB.py +++ b/tests/foreman/maintain/test_offload_DB.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/maintain/test_packages.py b/tests/foreman/maintain/test_packages.py index f0ae22d6d10..90483a6971f 100644 --- a/tests/foreman/maintain/test_packages.py +++ b/tests/foreman/maintain/test_packages.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/maintain/test_service.py b/tests/foreman/maintain/test_service.py index 3ff33790055..e35a55d9e00 100644 --- a/tests/foreman/maintain/test_service.py +++ b/tests/foreman/maintain/test_service.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + from fauxfactory import gen_string import pytest from wait_for import wait_for diff --git a/tests/foreman/maintain/test_upgrade.py b/tests/foreman/maintain/test_upgrade.py index 3bf72f1e2bb..a8134007994 100644 --- a/tests/foreman/maintain/test_upgrade.py +++ b/tests/foreman/maintain/test_upgrade.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/sanity/test_bvt.py b/tests/foreman/sanity/test_bvt.py index 7da1ccc3d8e..9c37152fa34 100644 --- a/tests/foreman/sanity/test_bvt.py +++ b/tests/foreman/sanity/test_bvt.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import re import pytest diff --git a/tests/foreman/sys/test_dynflow.py b/tests/foreman/sys/test_dynflow.py index 2b758bcb208..c93f3475d29 100644 --- a/tests/foreman/sys/test_dynflow.py +++ b/tests/foreman/sys/test_dynflow.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest diff --git a/tests/foreman/sys/test_fam.py b/tests/foreman/sys/test_fam.py index f4500a2b599..e4675d4f581 100644 --- a/tests/foreman/sys/test_fam.py +++ b/tests/foreman/sys/test_fam.py @@ -11,6 +11,7 @@ :Team: Platform """ + from broker import Broker import pytest diff --git a/tests/foreman/sys/test_katello_certs_check.py b/tests/foreman/sys/test_katello_certs_check.py index b330aeeec1b..bf93bc041f2 100644 --- a/tests/foreman/sys/test_katello_certs_check.py +++ b/tests/foreman/sys/test_katello_certs_check.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import re import pytest diff --git a/tests/foreman/sys/test_pulp3_filesystem.py b/tests/foreman/sys/test_pulp3_filesystem.py index ac747ca5f10..a0ab51630af 100644 --- a/tests/foreman/sys/test_pulp3_filesystem.py +++ b/tests/foreman/sys/test_pulp3_filesystem.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime import json diff --git a/tests/foreman/ui/test_acs.py b/tests/foreman/ui/test_acs.py index 40da1c22002..da5a3c144e9 100644 --- a/tests/foreman/ui/test_acs.py +++ b/tests/foreman/ui/test_acs.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo import constants diff --git a/tests/foreman/ui/test_activationkey.py b/tests/foreman/ui/test_activationkey.py index 7630a1761b9..98cf3cffa4b 100644 --- a/tests/foreman/ui/test_activationkey.py +++ b/tests/foreman/ui/test_activationkey.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from broker import Broker diff --git a/tests/foreman/ui/test_ansible.py b/tests/foreman/ui/test_ansible.py index c538ef099e1..4a9b4162563 100644 --- a/tests/foreman/ui/test_ansible.py +++ b/tests/foreman/ui/test_ansible.py @@ -8,6 +8,7 @@ :CaseImportance: Critical """ + from fauxfactory import gen_string import pytest from wait_for import wait_for @@ -182,7 +183,7 @@ def _finalize(): result = rhel_contenthost.execute(command) assert result.status == 0, f'Failed to register host: {result.stderr}' target_host = rhel_contenthost.nailgun_host - default_value = '[\"test\"]' + default_value = '[\"test\"]' # fmt: skip parameter_type = 'array' with target_sat.ui_session() as session: session.organization.select(org_name=module_org.name) diff --git a/tests/foreman/ui/test_architecture.py b/tests/foreman/ui/test_architecture.py index e6448f4442d..54dc1be1f9e 100644 --- a/tests/foreman/ui/test_architecture.py +++ b/tests/foreman/ui/test_architecture.py @@ -11,6 +11,7 @@ :CaseImportance: Low """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_audit.py b/tests/foreman/ui/test_audit.py index b7d0ce6344f..9c5cc172506 100644 --- a/tests/foreman/ui/test_audit.py +++ b/tests/foreman/ui/test_audit.py @@ -9,6 +9,7 @@ :Team: Endeavour """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_bookmarks.py b/tests/foreman/ui/test_bookmarks.py index 096f8fdf7cd..0670563ab66 100644 --- a/tests/foreman/ui/test_bookmarks.py +++ b/tests/foreman/ui/test_bookmarks.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from airgun.exceptions import DisabledWidgetError, NoSuchElementException from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_branding.py b/tests/foreman/ui/test_branding.py index 8fe30b1c2ef..0929285af18 100644 --- a/tests/foreman/ui/test_branding.py +++ b/tests/foreman/ui/test_branding.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest diff --git a/tests/foreman/ui/test_capsulecontent.py b/tests/foreman/ui/test_capsulecontent.py index 43fc34b430f..53d08b68411 100644 --- a/tests/foreman/ui/test_capsulecontent.py +++ b/tests/foreman/ui/test_capsulecontent.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/ui/test_computeprofiles.py b/tests/foreman/ui/test_computeprofiles.py index 035e09a9938..0f0cb99c1ea 100644 --- a/tests/foreman/ui/test_computeprofiles.py +++ b/tests/foreman/ui/test_computeprofiles.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest @@ -35,8 +36,8 @@ def test_positive_end_to_end(session, module_location, module_org, module_target session.computeprofile.create({'name': name}) assert module_target_sat.api.ComputeProfile().search(query={'search': f'name={name}'}), ( - 'Compute profile {} expected to exist, but is not included in the search ' - 'results'.format(name) + f'Compute profile {name} expected to exist, but is not included in the search ' + 'results' ) compute_resource_list = session.computeprofile.list_resources(name) assert f'{compute_resource.name} (Libvirt)' in [ @@ -46,13 +47,13 @@ def test_positive_end_to_end(session, module_location, module_org, module_target assert module_target_sat.api.ComputeProfile().search( query={'search': f'name={new_name}'} ), ( - 'Compute profile {} expected to exist, but is not included in the search ' - 'results'.format(new_name) + f'Compute profile {new_name} expected to exist, but is not included in the search ' + 'results' ) session.computeprofile.delete(new_name) assert not module_target_sat.api.ComputeProfile().search( query={'search': f'name={new_name}'} ), ( - 'Compute profile {} expected to be deleted, but is included in the search ' - 'results'.format(new_name) + f'Compute profile {new_name} expected to be deleted, but is included in the search ' + 'results' ) diff --git a/tests/foreman/ui/test_computeresource.py b/tests/foreman/ui/test_computeresource.py index abbc088aa47..b39cc00e3a6 100644 --- a/tests/foreman/ui/test_computeresource.py +++ b/tests/foreman/ui/test_computeresource.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from wait_for import wait_for @@ -288,7 +289,6 @@ def test_positive_VM_import(session, module_org, module_location, rhev_data, mod name = gen_string('alpha') with session: - session.computeresource.create( { 'name': name, diff --git a/tests/foreman/ui/test_computeresource_azurerm.py b/tests/foreman/ui/test_computeresource_azurerm.py index 36228513ffa..5d09ad88a69 100644 --- a/tests/foreman/ui/test_computeresource_azurerm.py +++ b/tests/foreman/ui/test_computeresource_azurerm.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_computeresource_ec2.py b/tests/foreman/ui/test_computeresource_ec2.py index 0d08685543c..1dae4eb7492 100644 --- a/tests/foreman/ui/test_computeresource_ec2.py +++ b/tests/foreman/ui/test_computeresource_ec2.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_computeresource_gce.py b/tests/foreman/ui/test_computeresource_gce.py index a25edb1da44..4c48e902809 100644 --- a/tests/foreman/ui/test_computeresource_gce.py +++ b/tests/foreman/ui/test_computeresource_gce.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import json import random diff --git a/tests/foreman/ui/test_computeresource_libvirt.py b/tests/foreman/ui/test_computeresource_libvirt.py index 42477b8d46a..8328f1a4cf1 100644 --- a/tests/foreman/ui/test_computeresource_libvirt.py +++ b/tests/foreman/ui/test_computeresource_libvirt.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from random import choice from fauxfactory import gen_string diff --git a/tests/foreman/ui/test_computeresource_vmware.py b/tests/foreman/ui/test_computeresource_vmware.py index f4304da506f..6e536af36e9 100644 --- a/tests/foreman/ui/test_computeresource_vmware.py +++ b/tests/foreman/ui/test_computeresource_vmware.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from math import floor, log10 from random import choice diff --git a/tests/foreman/ui/test_config_group.py b/tests/foreman/ui/test_config_group.py index b38384d2977..34e6b32b9c9 100644 --- a/tests/foreman/ui/test_config_group.py +++ b/tests/foreman/ui/test_config_group.py @@ -11,6 +11,7 @@ :CaseImportance: Low """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_containerimagetag.py b/tests/foreman/ui/test_containerimagetag.py index 41f8960d96d..9d8892e67ba 100644 --- a/tests/foreman/ui/test_containerimagetag.py +++ b/tests/foreman/ui/test_containerimagetag.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.constants import ( diff --git a/tests/foreman/ui/test_contentcredentials.py b/tests/foreman/ui/test_contentcredentials.py index 4fa3f519986..42be72d12ec 100644 --- a/tests/foreman/ui/test_contentcredentials.py +++ b/tests/foreman/ui/test_contentcredentials.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/ui/test_contenthost.py b/tests/foreman/ui/test_contenthost.py index 5f351076e5b..fc4071412b2 100644 --- a/tests/foreman/ui/test_contenthost.py +++ b/tests/foreman/ui/test_contenthost.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime, timedelta import re from urllib.parse import urlparse @@ -1773,7 +1774,7 @@ def test_pagination_multiple_hosts_multiple_pages(session, module_host_template, f'os = {module_host_template.operatingsystem.name}' ) # Assert dump of fake hosts found includes the higest numbered host created for this test - match = re.search(fr'test-{host_num:0>2}', str(all_fake_hosts_found)) + match = re.search(rf'test-{host_num:0>2}', str(all_fake_hosts_found)) assert match, 'Highest numbered host not found.' # Get all the pagination values pagination_values = session.contenthost.read_all('Pagination')['Pagination'] @@ -1811,8 +1812,8 @@ def test_search_for_virt_who_hypervisors(session, default_location, module_targe hypervisor_display_name = f'virt-who-{hypervisor_name}-{org.id}' # Search with hypervisor=True gives the correct result. assert ( - session.contenthost.search('hypervisor = true')[0]['Name'] - ) == hypervisor_display_name + (session.contenthost.search('hypervisor = true')[0]['Name']) == hypervisor_display_name + ) # Search with hypervisor=false gives the correct result. content_hosts = [host['Name'] for host in session.contenthost.search('hypervisor = false')] assert hypervisor_display_name not in content_hosts diff --git a/tests/foreman/ui/test_contentview.py b/tests/foreman/ui/test_contentview.py index 625d5fb927a..0d203fc7707 100644 --- a/tests/foreman/ui/test_contentview.py +++ b/tests/foreman/ui/test_contentview.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_contentview_old.py b/tests/foreman/ui/test_contentview_old.py index 0b846771257..1fb9aab98ad 100644 --- a/tests/foreman/ui/test_contentview_old.py +++ b/tests/foreman/ui/test_contentview_old.py @@ -14,6 +14,7 @@ :CaseImportance: High """ + import datetime from random import randint diff --git a/tests/foreman/ui/test_dashboard.py b/tests/foreman/ui/test_dashboard.py index 32c17a6345b..24443207095 100644 --- a/tests/foreman/ui/test_dashboard.py +++ b/tests/foreman/ui/test_dashboard.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from nailgun.entity_mixins import TaskFailedError import pytest @@ -52,14 +53,14 @@ def test_positive_host_configuration_status(session, target_sat): 'Hosts with no reports', ] search_strings_list = [ - 'last_report > \"30 minutes ago\" and (status.applied > 0 or' + 'last_report > "30 minutes ago" and (status.applied > 0 or' ' status.restarted > 0) and (status.failed = 0)', - 'last_report > \"30 minutes ago\" and (status.failed > 0 or' + 'last_report > "30 minutes ago" and (status.failed > 0 or' ' status.failed_restarts > 0) and status.enabled = true', - 'last_report > \"30 minutes ago\" and status.enabled = true and' + 'last_report > "30 minutes ago" and status.enabled = true and' ' status.applied = 0 and status.failed = 0 and status.pending = 0', - 'last_report > \"30 minutes ago\" and status.pending > 0 and status.enabled = true', - 'last_report < \"30 minutes ago\" and status.enabled = true', + 'last_report > "30 minutes ago" and status.pending > 0 and status.enabled = true', + 'last_report < "30 minutes ago" and status.enabled = true', 'status.enabled = false', 'not has last_report and status.enabled = true', ] diff --git a/tests/foreman/ui/test_discoveredhost.py b/tests/foreman/ui/test_discoveredhost.py index 64476188f89..82fbdf5ca9d 100644 --- a/tests/foreman/ui/test_discoveredhost.py +++ b/tests/foreman/ui/test_discoveredhost.py @@ -9,6 +9,7 @@ :Team: Rocket """ + from fauxfactory import gen_string import pytest from wait_for import wait_for diff --git a/tests/foreman/ui/test_discoveryrule.py b/tests/foreman/ui/test_discoveryrule.py index 83ab23cbcc2..85958d57e53 100644 --- a/tests/foreman/ui/test_discoveryrule.py +++ b/tests/foreman/ui/test_discoveryrule.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_integer, gen_ipaddr, gen_string import pytest diff --git a/tests/foreman/ui/test_domain.py b/tests/foreman/ui/test_domain.py index 4a116f762f0..51a8a048c54 100644 --- a/tests/foreman/ui/test_domain.py +++ b/tests/foreman/ui/test_domain.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_eol_banner.py b/tests/foreman/ui/test_eol_banner.py index c19b19838e6..cc3c46eadf0 100644 --- a/tests/foreman/ui/test_eol_banner.py +++ b/tests/foreman/ui/test_eol_banner.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime, timedelta from airgun.session import Session diff --git a/tests/foreman/ui/test_errata.py b/tests/foreman/ui/test_errata.py index 612f92786ae..ba5c9b27ab9 100644 --- a/tests/foreman/ui/test_errata.py +++ b/tests/foreman/ui/test_errata.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime, timedelta from broker import Broker @@ -163,10 +164,7 @@ def cv_publish_promote(sat, org, cv, lce=None, needs_publish=True): # Take a single instance of lce, or list of instances lce_ids = 'Library' if lce is not None: - if not isinstance(lce, list): - lce_ids = [lce.id] - else: - lce_ids = sorted(_lce.id for _lce in lce) + lce_ids = [lce.id] if not isinstance(lce, list) else sorted(_lce.id for _lce in lce) if needs_publish is True: _publish_and_wait(sat, org, cv) @@ -198,13 +196,16 @@ def _publish_and_wait(sat, org, cv): task_id = sat.api.ContentView(id=cv.id).publish({'id': cv.id, 'organization': org})['id'] assert task_id, f'No task was invoked to publish the Content-View: {cv.id}.' # Should take < 1 minute, check in 5s intervals - sat.wait_for_tasks( - search_query=(f'label = Actions::Katello::ContentView::Publish and id = {task_id}'), - search_rate=5, - max_tries=12, - ), ( - f'Failed to publish the Content-View: {cv.id}, in time.' - f'Task: {task_id} failed, or timed out (60s).' + ( + sat.wait_for_tasks( + search_query=(f'label = Actions::Katello::ContentView::Publish and id = {task_id}'), + search_rate=5, + max_tries=12, + ), + ( + f'Failed to publish the Content-View: {cv.id}, in time.' + f'Task: {task_id} failed, or timed out (60s).' + ), ) @@ -298,7 +299,14 @@ def registered_contenthost( @request.addfinalizer # Cleanup for in-between parameterized sessions def cleanup(): - nonlocal rhel_contenthost, module_cv, module_lce, custom_repos, custom_products, errata_host_ak, module_sca_manifest_org + nonlocal \ + rhel_contenthost, \ + module_cv, \ + module_lce, \ + custom_repos, \ + custom_products, \ + errata_host_ak, \ + module_sca_manifest_org rhel_contenthost.unregister() errata_host_ak.delete() # find any other aks and delete them diff --git a/tests/foreman/ui/test_hardwaremodel.py b/tests/foreman/ui/test_hardwaremodel.py index c2733d17d35..262bb567cee 100644 --- a/tests/foreman/ui/test_hardwaremodel.py +++ b/tests/foreman/ui/test_hardwaremodel.py @@ -9,6 +9,7 @@ :Team: Endeavour """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_host.py b/tests/foreman/ui/test_host.py index 0869a68290f..a767c85f788 100644 --- a/tests/foreman/ui/test_host.py +++ b/tests/foreman/ui/test_host.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import copy import csv import os diff --git a/tests/foreman/ui/test_hostcollection.py b/tests/foreman/ui/test_hostcollection.py index 91c76c55364..49ea829f4ba 100644 --- a/tests/foreman/ui/test_hostcollection.py +++ b/tests/foreman/ui/test_hostcollection.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import time from broker import Broker diff --git a/tests/foreman/ui/test_hostgroup.py b/tests/foreman/ui/test_hostgroup.py index 46d167194f7..3a7c8aeb582 100644 --- a/tests/foreman/ui/test_hostgroup.py +++ b/tests/foreman/ui/test_hostgroup.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_http_proxy.py b/tests/foreman/ui/test_http_proxy.py index 10d2249be30..625b4c6af3a 100644 --- a/tests/foreman/ui/test_http_proxy.py +++ b/tests/foreman/ui/test_http_proxy.py @@ -11,6 +11,7 @@ :CaseAutomation: Automated """ + from box import Box from fauxfactory import gen_integer, gen_string, gen_url import pytest diff --git a/tests/foreman/ui/test_jobtemplate.py b/tests/foreman/ui/test_jobtemplate.py index e2be74da640..c4ad3fa6ccb 100644 --- a/tests/foreman/ui/test_jobtemplate.py +++ b/tests/foreman/ui/test_jobtemplate.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_ldap_authentication.py b/tests/foreman/ui/test_ldap_authentication.py index 554244957fe..0fec6fba27a 100644 --- a/tests/foreman/ui/test_ldap_authentication.py +++ b/tests/foreman/ui/test_ldap_authentication.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import os from fauxfactory import gen_url @@ -404,9 +405,12 @@ def test_positive_delete_external_roles( session.usergroup.update( ldap_usergroup_name, {'roles.resources.unassigned': [foreman_role.name]} ) - with target_sat.ui_session( - test_name, ldap_data['ldap_user_name'], ldap_data['ldap_user_passwd'] - ) as ldapsession, pytest.raises(NavigationTriesExceeded): + with ( + target_sat.ui_session( + test_name, ldap_data['ldap_user_name'], ldap_data['ldap_user_passwd'] + ) as ldapsession, + pytest.raises(NavigationTriesExceeded), + ): ldapsession.location.create({'name': gen_string('alpha')}) @@ -758,9 +762,12 @@ def test_positive_login_user_basic_roles( role = target_sat.api.Role().create() permissions = {'Architecture': PERMISSIONS['Architecture']} target_sat.api_factory.create_role_permissions(role, permissions) - with target_sat.ui_session( - test_name, ldap_data['ldap_user_name'], ldap_data['ldap_user_passwd'] - ) as ldapsession, pytest.raises(NavigationTriesExceeded): + with ( + target_sat.ui_session( + test_name, ldap_data['ldap_user_name'], ldap_data['ldap_user_passwd'] + ) as ldapsession, + pytest.raises(NavigationTriesExceeded), + ): ldapsession.usergroup.search('') with session: session.user.update(ldap_data['ldap_user_name'], {'roles.resources.assigned': [role.name]}) @@ -792,9 +799,12 @@ def test_positive_login_user_password_otp( otp_pass = ( f"{default_ipa_host.ldap_user_passwd}{generate_otp(default_ipa_host.time_based_secret)}" ) - with target_sat.ui_session( - test_name, default_ipa_host.ipa_otp_username, otp_pass - ) as ldapsession, pytest.raises(NavigationTriesExceeded): + with ( + target_sat.ui_session( + test_name, default_ipa_host.ipa_otp_username, otp_pass + ) as ldapsession, + pytest.raises(NavigationTriesExceeded), + ): ldapsession.user.search('') users = target_sat.api.User().search( query={'search': f'login="{default_ipa_host.ipa_otp_username}"'} @@ -1210,11 +1220,14 @@ def test_userlist_with_external_admin( assert idm_user in ldapsession.task.read_all()['current_user'] # verify the users count with local admin and remote/external admin - with target_sat.ui_session( - user=idm_admin, password=settings.server.ssh_password - ) as remote_admin_session, target_sat.ui_session( - user=settings.server.admin_username, password=settings.server.admin_password - ) as local_admin_session: + with ( + target_sat.ui_session( + user=idm_admin, password=settings.server.ssh_password + ) as remote_admin_session, + target_sat.ui_session( + user=settings.server.admin_username, password=settings.server.admin_password + ) as local_admin_session, + ): assert local_admin_session.user.search(idm_user)[0]['Username'] == idm_user assert remote_admin_session.user.search(idm_user)[0]['Username'] == idm_user diff --git a/tests/foreman/ui/test_lifecycleenvironment.py b/tests/foreman/ui/test_lifecycleenvironment.py index 9c389fdd19d..f3c966bd10d 100644 --- a/tests/foreman/ui/test_lifecycleenvironment.py +++ b/tests/foreman/ui/test_lifecycleenvironment.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from navmazing import NavigationTriesExceeded import pytest diff --git a/tests/foreman/ui/test_location.py b/tests/foreman/ui/test_location.py index 2ddb1620b2f..123673b6692 100644 --- a/tests/foreman/ui/test_location.py +++ b/tests/foreman/ui/test_location.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_ipaddr, gen_string import pytest diff --git a/tests/foreman/ui/test_media.py b/tests/foreman/ui/test_media.py index 75a39f80edb..5c41ab40676 100644 --- a/tests/foreman/ui/test_media.py +++ b/tests/foreman/ui/test_media.py @@ -11,6 +11,7 @@ :CaseImportance: Low """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_modulestreams.py b/tests/foreman/ui/test_modulestreams.py index 8bdd808ec6c..6d782f1616b 100644 --- a/tests/foreman/ui/test_modulestreams.py +++ b/tests/foreman/ui/test_modulestreams.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_operatingsystem.py b/tests/foreman/ui/test_operatingsystem.py index 1324b556230..71a030772c6 100644 --- a/tests/foreman/ui/test_operatingsystem.py +++ b/tests/foreman/ui/test_operatingsystem.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.constants import HASH_TYPE diff --git a/tests/foreman/ui/test_organization.py b/tests/foreman/ui/test_organization.py index 152d6542b65..0d7eec72cfc 100644 --- a/tests/foreman/ui/test_organization.py +++ b/tests/foreman/ui/test_organization.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_oscapcontent.py b/tests/foreman/ui/test_oscapcontent.py index 5669fb9e854..a87abb91e75 100644 --- a/tests/foreman/ui/test_oscapcontent.py +++ b/tests/foreman/ui/test_oscapcontent.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import os import pytest diff --git a/tests/foreman/ui/test_oscappolicy.py b/tests/foreman/ui/test_oscappolicy.py index bbfc9492c78..7f0e98e0014 100644 --- a/tests/foreman/ui/test_oscappolicy.py +++ b/tests/foreman/ui/test_oscappolicy.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.constants import OSCAP_PROFILE diff --git a/tests/foreman/ui/test_oscaptailoringfile.py b/tests/foreman/ui/test_oscaptailoringfile.py index 0145ac250cc..346db2c10e7 100644 --- a/tests/foreman/ui/test_oscaptailoringfile.py +++ b/tests/foreman/ui/test_oscaptailoringfile.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.utils.datafactory import gen_string diff --git a/tests/foreman/ui/test_package.py b/tests/foreman/ui/test_package.py index 9d6e91a9ab8..8dadbfe2d01 100644 --- a/tests/foreman/ui/test_package.py +++ b/tests/foreman/ui/test_package.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_partitiontable.py b/tests/foreman/ui/test_partitiontable.py index 127dc1ec67f..b8f0416331f 100644 --- a/tests/foreman/ui/test_partitiontable.py +++ b/tests/foreman/ui/test_partitiontable.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_product.py b/tests/foreman/ui/test_product.py index 88f2eb1e521..4fd89223523 100644 --- a/tests/foreman/ui/test_product.py +++ b/tests/foreman/ui/test_product.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import timedelta from fauxfactory import gen_choice diff --git a/tests/foreman/ui/test_provisioningtemplate.py b/tests/foreman/ui/test_provisioningtemplate.py index da2b8446dce..7ad306e2465 100644 --- a/tests/foreman/ui/test_provisioningtemplate.py +++ b/tests/foreman/ui/test_provisioningtemplate.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.constants import DataFile diff --git a/tests/foreman/ui/test_puppetclass.py b/tests/foreman/ui/test_puppetclass.py index b44ad73e7a7..42ae2b359ab 100644 --- a/tests/foreman/ui/test_puppetclass.py +++ b/tests/foreman/ui/test_puppetclass.py @@ -11,6 +11,7 @@ :CaseImportance: Low """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_puppetenvironment.py b/tests/foreman/ui/test_puppetenvironment.py index 57502a51191..6add5508549 100644 --- a/tests/foreman/ui/test_puppetenvironment.py +++ b/tests/foreman/ui/test_puppetenvironment.py @@ -11,6 +11,7 @@ :CaseImportance: Low """ + import pytest from robottelo.constants import DEFAULT_CV, ENVIRONMENT diff --git a/tests/foreman/ui/test_registration.py b/tests/foreman/ui/test_registration.py index 9d223340a35..65c79b8163c 100644 --- a/tests/foreman/ui/test_registration.py +++ b/tests/foreman/ui/test_registration.py @@ -10,6 +10,7 @@ :Team: Rocket """ + from datetime import datetime import re @@ -540,7 +541,6 @@ def test_positive_host_registration_with_non_admin_user( with module_target_sat.ui_session( test_name, user=user.login, password=user_password ) as session: - cmd = session.host_new.get_register_command( { 'general.insecure': True, diff --git a/tests/foreman/ui/test_remoteexecution.py b/tests/foreman/ui/test_remoteexecution.py index 8937b00277a..396a707c771 100644 --- a/tests/foreman/ui/test_remoteexecution.py +++ b/tests/foreman/ui/test_remoteexecution.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import datetime import time diff --git a/tests/foreman/ui/test_reporttemplates.py b/tests/foreman/ui/test_reporttemplates.py index fe833d683fb..79a4424007a 100644 --- a/tests/foreman/ui/test_reporttemplates.py +++ b/tests/foreman/ui/test_reporttemplates.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import csv import json import os diff --git a/tests/foreman/ui/test_repositories.py b/tests/foreman/ui/test_repositories.py index d75f456cf78..081c2d96fd8 100644 --- a/tests/foreman/ui/test_repositories.py +++ b/tests/foreman/ui/test_repositories.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest diff --git a/tests/foreman/ui/test_repository.py b/tests/foreman/ui/test_repository.py index 9bc6023c873..554d61babd9 100644 --- a/tests/foreman/ui/test_repository.py +++ b/tests/foreman/ui/test_repository.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime, timedelta from random import randint, shuffle diff --git a/tests/foreman/ui/test_rhc.py b/tests/foreman/ui/test_rhc.py index df90a5768ca..b9f02dcee8f 100644 --- a/tests/foreman/ui/test_rhc.py +++ b/tests/foreman/ui/test_rhc.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime, timedelta from fauxfactory import gen_string diff --git a/tests/foreman/ui/test_rhcloud_insights.py b/tests/foreman/ui/test_rhcloud_insights.py index 3646658c2b0..286727095d1 100644 --- a/tests/foreman/ui/test_rhcloud_insights.py +++ b/tests/foreman/ui/test_rhcloud_insights.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime import pytest diff --git a/tests/foreman/ui/test_rhcloud_inventory.py b/tests/foreman/ui/test_rhcloud_inventory.py index 9c98ade0205..f576f88b3e0 100644 --- a/tests/foreman/ui/test_rhcloud_inventory.py +++ b/tests/foreman/ui/test_rhcloud_inventory.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime, timedelta import pytest diff --git a/tests/foreman/ui/test_role.py b/tests/foreman/ui/test_role.py index 652bdcbd4f6..6a93789f6aa 100644 --- a/tests/foreman/ui/test_role.py +++ b/tests/foreman/ui/test_role.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from navmazing import NavigationTriesExceeded diff --git a/tests/foreman/ui/test_search.py b/tests/foreman/ui/test_search.py index cc9120bfc2b..df58459e2a1 100644 --- a/tests/foreman/ui/test_search.py +++ b/tests/foreman/ui/test_search.py @@ -10,6 +10,7 @@ :CaseImportance: Medium """ + from collections import namedtuple from fauxfactory import gen_string diff --git a/tests/foreman/ui/test_settings.py b/tests/foreman/ui/test_settings.py index c3c233bf97e..fee05bee938 100644 --- a/tests/foreman/ui/test_settings.py +++ b/tests/foreman/ui/test_settings.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import math from fauxfactory import gen_url diff --git a/tests/foreman/ui/test_smartclassparameter.py b/tests/foreman/ui/test_smartclassparameter.py index adc5169f2ae..7cfe14cd036 100644 --- a/tests/foreman/ui/test_smartclassparameter.py +++ b/tests/foreman/ui/test_smartclassparameter.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from random import choice, uniform import pytest diff --git a/tests/foreman/ui/test_subnet.py b/tests/foreman/ui/test_subnet.py index 45886c3ec86..c29bfcb850a 100644 --- a/tests/foreman/ui/test_subnet.py +++ b/tests/foreman/ui/test_subnet.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_ipaddr import pytest diff --git a/tests/foreman/ui/test_subscription.py b/tests/foreman/ui/test_subscription.py index 45bfcd47d91..4157d6c5e47 100644 --- a/tests/foreman/ui/test_subscription.py +++ b/tests/foreman/ui/test_subscription.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from tempfile import mkstemp import time diff --git a/tests/foreman/ui/test_sync.py b/tests/foreman/ui/test_sync.py index d4351bc4923..399f214a3f8 100644 --- a/tests/foreman/ui/test_sync.py +++ b/tests/foreman/ui/test_sync.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_syncplan.py b/tests/foreman/ui/test_syncplan.py index 70a2a31a81c..b4be83f7141 100644 --- a/tests/foreman/ui/test_syncplan.py +++ b/tests/foreman/ui/test_syncplan.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime, timedelta import time diff --git a/tests/foreman/ui/test_templatesync.py b/tests/foreman/ui/test_templatesync.py index 766608cd306..e76444ee4a0 100644 --- a/tests/foreman/ui/test_templatesync.py +++ b/tests/foreman/ui/test_templatesync.py @@ -9,6 +9,7 @@ :Team: Endeavour """ + from fauxfactory import gen_string import pytest import requests diff --git a/tests/foreman/ui/test_user.py b/tests/foreman/ui/test_user.py index 72e56d8241d..0130409eab3 100644 --- a/tests/foreman/ui/test_user.py +++ b/tests/foreman/ui/test_user.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from fauxfactory import gen_email, gen_string diff --git a/tests/foreman/ui/test_usergroup.py b/tests/foreman/ui/test_usergroup.py index a3196188f40..46e20ffe7ad 100644 --- a/tests/foreman/ui/test_usergroup.py +++ b/tests/foreman/ui/test_usergroup.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string, gen_utf8 import pytest diff --git a/tests/foreman/ui/test_webhook.py b/tests/foreman/ui/test_webhook.py index c0e3b470c20..90668a8f9d9 100644 --- a/tests/foreman/ui/test_webhook.py +++ b/tests/foreman/ui/test_webhook.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string, gen_url import pytest diff --git a/tests/foreman/virtwho/api/test_esx.py b/tests/foreman/virtwho/api/test_esx.py index bb6046188a0..4b208bae4c8 100644 --- a/tests/foreman/virtwho/api/test_esx.py +++ b/tests/foreman/virtwho/api/test_esx.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings @@ -359,9 +360,7 @@ def test_positive_remove_env_option( # Check the option "env=" should be removed from etc/virt-who.d/virt-who.conf option = "env" config_file = get_configure_file(virtwho_config_api.id) - env_error = ( - f"option {{\'{option}\'}} is not exist or not be enabled in {{\'{config_file}\'}}" - ) + env_error = f"option {{'{option}'}} is not exist or not be enabled in {{'{config_file}'}}" with pytest.raises(Exception) as exc_info: # noqa: PT011 - TODO determine better exception get_configure_option({option}, {config_file}) assert str(exc_info.value) == env_error diff --git a/tests/foreman/virtwho/api/test_esx_sca.py b/tests/foreman/virtwho/api/test_esx_sca.py index 2d43f59637a..10c9500eed9 100644 --- a/tests/foreman/virtwho/api/test_esx_sca.py +++ b/tests/foreman/virtwho/api/test_esx_sca.py @@ -9,6 +9,7 @@ :Team: Phoenix """ + import pytest from robottelo.config import settings @@ -407,9 +408,7 @@ def test_positive_remove_env_option( # Check the option "env=" should be removed from etc/virt-who.d/virt-who.conf option = "env" config_file = get_configure_file(virtwho_config_api.id) - env_error = ( - f"option {{\'{option}\'}} is not exist or not be enabled in {{\'{config_file}\'}}" - ) + env_error = f"option {{'{option}'}} is not exist or not be enabled in {{'{config_file}'}}" with pytest.raises(Exception) as exc_info: # noqa: PT011 - TODO determine better exception get_configure_option({option}, {config_file}) assert str(exc_info.value) == env_error diff --git a/tests/foreman/virtwho/api/test_hyperv.py b/tests/foreman/virtwho/api/test_hyperv.py index 6d93f1ddb9a..d66c13ed62f 100644 --- a/tests/foreman/virtwho/api/test_hyperv.py +++ b/tests/foreman/virtwho/api/test_hyperv.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/virtwho/api/test_hyperv_sca.py b/tests/foreman/virtwho/api/test_hyperv_sca.py index 715ac92cd12..e74748cde66 100644 --- a/tests/foreman/virtwho/api/test_hyperv_sca.py +++ b/tests/foreman/virtwho/api/test_hyperv_sca.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.utils.virtwho import ( diff --git a/tests/foreman/virtwho/api/test_kubevirt.py b/tests/foreman/virtwho/api/test_kubevirt.py index ef1e7ac578d..ece48a67245 100644 --- a/tests/foreman/virtwho/api/test_kubevirt.py +++ b/tests/foreman/virtwho/api/test_kubevirt.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/virtwho/api/test_kubevirt_sca.py b/tests/foreman/virtwho/api/test_kubevirt_sca.py index 51628052cd9..56f34e17ecb 100644 --- a/tests/foreman/virtwho/api/test_kubevirt_sca.py +++ b/tests/foreman/virtwho/api/test_kubevirt_sca.py @@ -9,6 +9,7 @@ :team: Phoenix-subscriptions """ + import pytest from robottelo.utils.virtwho import ( diff --git a/tests/foreman/virtwho/api/test_libvirt.py b/tests/foreman/virtwho/api/test_libvirt.py index b551e0e81dc..677d5124a24 100644 --- a/tests/foreman/virtwho/api/test_libvirt.py +++ b/tests/foreman/virtwho/api/test_libvirt.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/virtwho/api/test_libvirt_sca.py b/tests/foreman/virtwho/api/test_libvirt_sca.py index f88edd8d478..34d6b78f84c 100644 --- a/tests/foreman/virtwho/api/test_libvirt_sca.py +++ b/tests/foreman/virtwho/api/test_libvirt_sca.py @@ -9,6 +9,7 @@ :team: Phoenix-subscriptions """ + import pytest from robottelo.utils.virtwho import ( diff --git a/tests/foreman/virtwho/api/test_nutanix.py b/tests/foreman/virtwho/api/test_nutanix.py index e40433b1c57..6e29e638478 100644 --- a/tests/foreman/virtwho/api/test_nutanix.py +++ b/tests/foreman/virtwho/api/test_nutanix.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/virtwho/api/test_nutanix_sca.py b/tests/foreman/virtwho/api/test_nutanix_sca.py index 14b6d2a04fd..b6f7bbc9356 100644 --- a/tests/foreman/virtwho/api/test_nutanix_sca.py +++ b/tests/foreman/virtwho/api/test_nutanix_sca.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.utils.virtwho import ( diff --git a/tests/foreman/virtwho/cli/test_esx.py b/tests/foreman/virtwho/cli/test_esx.py index c18ffb3ab30..0b148edbfc4 100644 --- a/tests/foreman/virtwho/cli/test_esx.py +++ b/tests/foreman/virtwho/cli/test_esx.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import re from fauxfactory import gen_string @@ -410,9 +411,7 @@ def test_positive_remove_env_option( # Check the option "env=" should be removed from etc/virt-who.d/virt-who.conf option = "env" config_file = get_configure_file(virtwho_config_cli['id']) - env_error = ( - f"option {{\'{option}\'}} is not exist or not be enabled in {{\'{config_file}\'}}" - ) + env_error = f"option {{'{option}'}} is not exist or not be enabled in {{'{config_file}'}}" with pytest.raises(Exception) as exc_info: # noqa: PT011 - TODO determine better exception get_configure_option({option}, {config_file}) assert str(exc_info.value) == env_error diff --git a/tests/foreman/virtwho/cli/test_esx_sca.py b/tests/foreman/virtwho/cli/test_esx_sca.py index 6b15b6803f9..a6c2e4843e2 100644 --- a/tests/foreman/virtwho/cli/test_esx_sca.py +++ b/tests/foreman/virtwho/cli/test_esx_sca.py @@ -9,6 +9,7 @@ :Team: Phoenix """ + import re from fauxfactory import gen_string @@ -492,9 +493,7 @@ def test_positive_remove_env_option( # Check the option "env=" should be removed from etc/virt-who.d/virt-who.conf option = "env" config_file = get_configure_file(virtwho_config_cli['id']) - env_error = ( - f"option {{\'{option}\'}} is not exist or not be enabled in {{\'{config_file}\'}}" - ) + env_error = f"option {{'{option}'}} is not exist or not be enabled in {{'{config_file}'}}" with pytest.raises(Exception) as exc_info: # noqa: PT011 - TODO determine better exception get_configure_option({option}, {config_file}) assert str(exc_info.value) == env_error diff --git a/tests/foreman/virtwho/cli/test_hyperv.py b/tests/foreman/virtwho/cli/test_hyperv.py index 657ee3e04f6..98f84d277e1 100644 --- a/tests/foreman/virtwho/cli/test_hyperv.py +++ b/tests/foreman/virtwho/cli/test_hyperv.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/virtwho/cli/test_hyperv_sca.py b/tests/foreman/virtwho/cli/test_hyperv_sca.py index 7c59213485d..e72da8f78e0 100644 --- a/tests/foreman/virtwho/cli/test_hyperv_sca.py +++ b/tests/foreman/virtwho/cli/test_hyperv_sca.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.utils.virtwho import ( diff --git a/tests/foreman/virtwho/cli/test_kubevirt.py b/tests/foreman/virtwho/cli/test_kubevirt.py index f29a22e4a16..88e9bcdcc2e 100644 --- a/tests/foreman/virtwho/cli/test_kubevirt.py +++ b/tests/foreman/virtwho/cli/test_kubevirt.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/virtwho/cli/test_kubevirt_sca.py b/tests/foreman/virtwho/cli/test_kubevirt_sca.py index d682b5f9159..1c96fbc88a6 100644 --- a/tests/foreman/virtwho/cli/test_kubevirt_sca.py +++ b/tests/foreman/virtwho/cli/test_kubevirt_sca.py @@ -9,6 +9,7 @@ :team: Phoenix-subscriptions """ + import pytest from robottelo.utils.virtwho import ( diff --git a/tests/foreman/virtwho/cli/test_libvirt.py b/tests/foreman/virtwho/cli/test_libvirt.py index 70ac4056fa3..ea8f09c9cd0 100644 --- a/tests/foreman/virtwho/cli/test_libvirt.py +++ b/tests/foreman/virtwho/cli/test_libvirt.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/virtwho/cli/test_libvirt_sca.py b/tests/foreman/virtwho/cli/test_libvirt_sca.py index 2bfeda30801..85ee3e8d7f0 100644 --- a/tests/foreman/virtwho/cli/test_libvirt_sca.py +++ b/tests/foreman/virtwho/cli/test_libvirt_sca.py @@ -9,6 +9,7 @@ :team: Phoenix-subscriptions """ + import pytest from robottelo.utils.virtwho import ( diff --git a/tests/foreman/virtwho/cli/test_nutanix.py b/tests/foreman/virtwho/cli/test_nutanix.py index b5478912ab7..7233e8454d2 100644 --- a/tests/foreman/virtwho/cli/test_nutanix.py +++ b/tests/foreman/virtwho/cli/test_nutanix.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/virtwho/cli/test_nutanix_sca.py b/tests/foreman/virtwho/cli/test_nutanix_sca.py index 360aac0f676..a3ed65953a3 100644 --- a/tests/foreman/virtwho/cli/test_nutanix_sca.py +++ b/tests/foreman/virtwho/cli/test_nutanix_sca.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.utils.virtwho import ( diff --git a/tests/foreman/virtwho/ui/test_esx.py b/tests/foreman/virtwho/ui/test_esx.py index efd46e6deba..dc615e7b4a5 100644 --- a/tests/foreman/virtwho/ui/test_esx.py +++ b/tests/foreman/virtwho/ui/test_esx.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime from fauxfactory import gen_string @@ -731,9 +732,7 @@ def test_positive_remove_env_option( option = "env" config_id = get_configure_id(name) config_file = get_configure_file(config_id) - env_error = ( - f"option {{\'{option}\'}} is not exist or not be enabled in {{\'{config_file}\'}}" - ) + env_error = f"option {{'{option}'}} is not exist or not be enabled in {{'{config_file}'}}" with pytest.raises(Exception) as exc_info: # noqa: PT011 - TODO determine better exception get_configure_option({option}, {config_file}) assert str(exc_info.value) == env_error diff --git a/tests/foreman/virtwho/ui/test_esx_sca.py b/tests/foreman/virtwho/ui/test_esx_sca.py index 3656ba09038..118e7a0cfb0 100644 --- a/tests/foreman/virtwho/ui/test_esx_sca.py +++ b/tests/foreman/virtwho/ui/test_esx_sca.py @@ -9,6 +9,7 @@ :team: Phoenix-subscriptions """ + from datetime import datetime from airgun.session import Session @@ -312,9 +313,7 @@ def test_positive_remove_env_option( option = "env" config_id = get_configure_id(name) config_file = get_configure_file(config_id) - env_error = ( - f"option {{\'{option}\'}} is not exist or not be enabled in {{\'{config_file}\'}}" - ) + env_error = f"option {{'{option}'}} is not exist or not be enabled in {{'{config_file}'}}" with pytest.raises(Exception) as exc_info: # noqa: PT011 - TODO determine better exception get_configure_option({option}, {config_file}) assert str(exc_info.value) == env_error diff --git a/tests/foreman/virtwho/ui/test_hyperv.py b/tests/foreman/virtwho/ui/test_hyperv.py index 8348540326f..2db519760fe 100644 --- a/tests/foreman/virtwho/ui/test_hyperv.py +++ b/tests/foreman/virtwho/ui/test_hyperv.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/virtwho/ui/test_hyperv_sca.py b/tests/foreman/virtwho/ui/test_hyperv_sca.py index a5b560c99a1..5fcd47bdb88 100644 --- a/tests/foreman/virtwho/ui/test_hyperv_sca.py +++ b/tests/foreman/virtwho/ui/test_hyperv_sca.py @@ -9,6 +9,7 @@ :team: Phoenix-subscriptions """ + import pytest from robottelo.utils.virtwho import ( diff --git a/tests/foreman/virtwho/ui/test_kubevirt.py b/tests/foreman/virtwho/ui/test_kubevirt.py index e12c4774fc8..0f8a01f3177 100644 --- a/tests/foreman/virtwho/ui/test_kubevirt.py +++ b/tests/foreman/virtwho/ui/test_kubevirt.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/virtwho/ui/test_kubevirt_sca.py b/tests/foreman/virtwho/ui/test_kubevirt_sca.py index a1554929866..14714df675d 100644 --- a/tests/foreman/virtwho/ui/test_kubevirt_sca.py +++ b/tests/foreman/virtwho/ui/test_kubevirt_sca.py @@ -9,6 +9,7 @@ :team: Phoenix-subscriptions """ + import pytest from robottelo.utils.virtwho import ( diff --git a/tests/foreman/virtwho/ui/test_libvirt.py b/tests/foreman/virtwho/ui/test_libvirt.py index a66bf1737bb..1d1ffaa0dcc 100644 --- a/tests/foreman/virtwho/ui/test_libvirt.py +++ b/tests/foreman/virtwho/ui/test_libvirt.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/virtwho/ui/test_libvirt_sca.py b/tests/foreman/virtwho/ui/test_libvirt_sca.py index ffef902441e..66c73926ab8 100644 --- a/tests/foreman/virtwho/ui/test_libvirt_sca.py +++ b/tests/foreman/virtwho/ui/test_libvirt_sca.py @@ -9,6 +9,7 @@ :team: Phoenix-subscriptions """ + import pytest from robottelo.utils.virtwho import ( diff --git a/tests/foreman/virtwho/ui/test_nutanix.py b/tests/foreman/virtwho/ui/test_nutanix.py index 7ec05f191df..2b7295fd359 100644 --- a/tests/foreman/virtwho/ui/test_nutanix.py +++ b/tests/foreman/virtwho/ui/test_nutanix.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/virtwho/ui/test_nutanix_sca.py b/tests/foreman/virtwho/ui/test_nutanix_sca.py index bb2483195d1..b085fc55ec1 100644 --- a/tests/foreman/virtwho/ui/test_nutanix_sca.py +++ b/tests/foreman/virtwho/ui/test_nutanix_sca.py @@ -9,6 +9,7 @@ :Team: Phoenix-subscriptions """ + from fauxfactory import gen_string import pytest diff --git a/tests/robottelo/test_datafactory.py b/tests/robottelo/test_datafactory.py index b93d401ed89..9d8406640c4 100644 --- a/tests/robottelo/test_datafactory.py +++ b/tests/robottelo/test_datafactory.py @@ -1,4 +1,5 @@ """Tests for module ``robottelo.utils.datafactory``.""" + import itertools import random from unittest import mock diff --git a/tests/robottelo/test_decorators.py b/tests/robottelo/test_decorators.py index 6c5e60f568a..9a50461962a 100644 --- a/tests/robottelo/test_decorators.py +++ b/tests/robottelo/test_decorators.py @@ -1,4 +1,5 @@ """Unit tests for :mod:`robottelo.utils.decorators`.""" + from unittest import mock import pytest diff --git a/tests/robottelo/test_dependencies.py b/tests/robottelo/test_dependencies.py index 950cbeebec4..d12372a64a8 100644 --- a/tests/robottelo/test_dependencies.py +++ b/tests/robottelo/test_dependencies.py @@ -1,4 +1,5 @@ """Test important behavior in robottelo's direct dependencies""" + import contextlib diff --git a/tests/robottelo/test_func_locker.py b/tests/robottelo/test_func_locker.py index d0da97431e0..de2ef29aa33 100644 --- a/tests/robottelo/test_func_locker.py +++ b/tests/robottelo/test_func_locker.py @@ -96,8 +96,9 @@ def simple_recursive_locking_function(): """try to trigger the same lock from the same process, an exception should be expected """ - with func_locker.locking_function(simple_locked_function), func_locker.locking_function( - simple_locked_function + with ( + func_locker.locking_function(simple_locked_function), + func_locker.locking_function(simple_locked_function), ): pass return 'I should not be reached' @@ -125,9 +126,10 @@ def simple_function_to_lock(): def simple_with_locking_function(index=None): global counter_file time.sleep(0.05) - with func_locker.locking_function(simple_locked_function), open( - _get_function_lock_path('simple_locked_function') - ) as rf: + with ( + func_locker.locking_function(simple_locked_function), + open(_get_function_lock_path('simple_locked_function')) as rf, + ): content = rf.read() if index is not None: @@ -234,9 +236,10 @@ def test_locker_file_location_when_in_class(self): content = '' assert str(os.getpid()) != content - with func_locker.locking_function(SimpleClass.simple_function_to_lock), open( - file_path - ) as rf: + with ( + func_locker.locking_function(SimpleClass.simple_function_to_lock), + open(file_path) as rf, + ): content = rf.read() assert str(os.getpid()) == content @@ -249,9 +252,10 @@ def test_locker_file_location_when_in_class(self): content = '' assert str(os.getpid()) != content - with func_locker.locking_function(SimpleClass.simple_function_to_lock_cls), open( - file_path - ) as rf: + with ( + func_locker.locking_function(SimpleClass.simple_function_to_lock_cls), + open(file_path) as rf, + ): content = rf.read() assert str(os.getpid()) == content @@ -296,9 +300,10 @@ def test_locker_file_location_when_in_class(self): else: content = '' assert str(os.getpid()) != content - with func_locker.locking_function(SimpleClass.SubClass.simple_function_to_lock_cls), open( - file_path - ) as rf: + with ( + func_locker.locking_function(SimpleClass.SubClass.simple_function_to_lock_cls), + open(file_path) as rf, + ): content = rf.read() assert str(os.getpid()) == content @@ -410,7 +415,8 @@ def test_scoped_with_locking(self): assert os.path.exists(lock_file_path) def test_negative_with_locking_not_locked(self): - with pytest.raises( - func_locker.FunctionLockerError, match=r'.*Cannot ensure locking.*' - ), func_locker.locking_function(simple_function_not_locked): + with ( + pytest.raises(func_locker.FunctionLockerError, match=r'.*Cannot ensure locking.*'), + func_locker.locking_function(simple_function_not_locked), + ): pass diff --git a/tests/robottelo/test_hammer.py b/tests/robottelo/test_hammer.py index 0a887a4c0bc..fce548fa0d6 100644 --- a/tests/robottelo/test_hammer.py +++ b/tests/robottelo/test_hammer.py @@ -1,4 +1,5 @@ """Tests for Robottelo's hammer helpers""" + from robottelo.cli import hammer diff --git a/tests/robottelo/test_helpers.py b/tests/robottelo/test_helpers.py index 0b39bb54b9e..b73fb78af7d 100644 --- a/tests/robottelo/test_helpers.py +++ b/tests/robottelo/test_helpers.py @@ -1,4 +1,5 @@ """Tests for module ``robottelo.helpers``.""" + import pytest from robottelo.utils import slugify_component, validate_ssh_pub_key diff --git a/tests/robottelo/test_issue_handlers.py b/tests/robottelo/test_issue_handlers.py index d8fdce0c7b0..430cf18644b 100644 --- a/tests/robottelo/test_issue_handlers.py +++ b/tests/robottelo/test_issue_handlers.py @@ -365,7 +365,6 @@ def _remove_file(): os.remove(DEFAULT_BZ_CACHE_FILE) try: - subprocess.run( [sys.executable, '-m', 'pytest', '--collect-only', 'tests/robottelo'], check=True ) @@ -408,7 +407,11 @@ def test_add_workaround(): add_workaround(data, matches, 'test', foo='bar') add_workaround( - data, matches, 'test', validation=lambda *a, **k: False, zaz='traz' # Should not be added + data, + matches, + 'test', + validation=lambda *a, **k: False, + zaz='traz', # Should not be added ) for match in matches: diff --git a/tests/robottelo/test_ssh.py b/tests/robottelo/test_ssh.py index 6167a0292be..28012695d96 100644 --- a/tests/robottelo/test_ssh.py +++ b/tests/robottelo/test_ssh.py @@ -1,4 +1,5 @@ """Tests for module ``robottelo.utils.ssh``.""" + from unittest import mock from robottelo import ssh diff --git a/tests/upgrades/conftest.py b/tests/upgrades/conftest.py index 4c759f66b72..afa8c8eb21c 100644 --- a/tests/upgrades/conftest.py +++ b/tests/upgrades/conftest.py @@ -81,6 +81,7 @@ def test_capsule_post_upgrade_skipped(pre_upgrade_data): # in post_upgrade scenario, test results should be # 2 passed, 6 deselected """ + import datetime import functools import json diff --git a/tests/upgrades/test_activation_key.py b/tests/upgrades/test_activation_key.py index 11d37ccdab0..540c5b52b58 100644 --- a/tests/upgrades/test_activation_key.py +++ b/tests/upgrades/test_activation_key.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from requests.exceptions import HTTPError diff --git a/tests/upgrades/test_bookmarks.py b/tests/upgrades/test_bookmarks.py index ff53bcdb30b..f9f0986aec0 100644 --- a/tests/upgrades/test_bookmarks.py +++ b/tests/upgrades/test_bookmarks.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.constants import BOOKMARK_ENTITIES_SELECTION diff --git a/tests/upgrades/test_capsule.py b/tests/upgrades/test_capsule.py index c7cf63e9977..e106c9a860e 100644 --- a/tests/upgrades/test_capsule.py +++ b/tests/upgrades/test_capsule.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import os import pytest diff --git a/tests/upgrades/test_classparameter.py b/tests/upgrades/test_classparameter.py index b7f8d1c6ed1..f0fd73f78ad 100644 --- a/tests/upgrades/test_classparameter.py +++ b/tests/upgrades/test_classparameter.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import json import pytest diff --git a/tests/upgrades/test_client.py b/tests/upgrades/test_client.py index c89496485be..94fc71d1de9 100644 --- a/tests/upgrades/test_client.py +++ b/tests/upgrades/test_client.py @@ -14,6 +14,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/upgrades/test_contentview.py b/tests/upgrades/test_contentview.py index 2b581297b1e..537ea003e03 100644 --- a/tests/upgrades/test_contentview.py +++ b/tests/upgrades/test_contentview.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_alpha import pytest diff --git a/tests/upgrades/test_discovery.py b/tests/upgrades/test_discovery.py index c85e02e01f4..1cf7404fb19 100644 --- a/tests/upgrades/test_discovery.py +++ b/tests/upgrades/test_discovery.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import re from packaging.version import Version diff --git a/tests/upgrades/test_errata.py b/tests/upgrades/test_errata.py index 90dec2b3058..1425d341158 100644 --- a/tests/upgrades/test_errata.py +++ b/tests/upgrades/test_errata.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest from wait_for import wait_for diff --git a/tests/upgrades/test_host.py b/tests/upgrades/test_host.py index b60585d63bd..b5db455ab33 100644 --- a/tests/upgrades/test_host.py +++ b/tests/upgrades/test_host.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/upgrades/test_hostcontent.py b/tests/upgrades/test_hostcontent.py index 0a6a60e2a9e..b8faff77feb 100644 --- a/tests/upgrades/test_hostcontent.py +++ b/tests/upgrades/test_hostcontent.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest diff --git a/tests/upgrades/test_hostgroup.py b/tests/upgrades/test_hostgroup.py index a6d67a106db..a61e854bc5c 100644 --- a/tests/upgrades/test_hostgroup.py +++ b/tests/upgrades/test_hostgroup.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/upgrades/test_performance_tuning.py b/tests/upgrades/test_performance_tuning.py index 33237e8f561..28a30aeed95 100644 --- a/tests/upgrades/test_performance_tuning.py +++ b/tests/upgrades/test_performance_tuning.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import filecmp import pytest diff --git a/tests/upgrades/test_provisioningtemplate.py b/tests/upgrades/test_provisioningtemplate.py index 7c603c30a53..cc686e3d22f 100644 --- a/tests/upgrades/test_provisioningtemplate.py +++ b/tests/upgrades/test_provisioningtemplate.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/upgrades/test_puppet.py b/tests/upgrades/test_puppet.py index b0c96394cc8..9c8f53fbbe1 100644 --- a/tests/upgrades/test_puppet.py +++ b/tests/upgrades/test_puppet.py @@ -11,6 +11,7 @@ :CaseImportance: Medium """ + import pytest diff --git a/tests/upgrades/test_remoteexecution.py b/tests/upgrades/test_remoteexecution.py index 6aeaecb8639..6eba06e1b73 100644 --- a/tests/upgrades/test_remoteexecution.py +++ b/tests/upgrades/test_remoteexecution.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest diff --git a/tests/upgrades/test_repository.py b/tests/upgrades/test_repository.py index 31233d820c6..9b4de62f02f 100644 --- a/tests/upgrades/test_repository.py +++ b/tests/upgrades/test_repository.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/upgrades/test_role.py b/tests/upgrades/test_role.py index 25c0ab411c5..1af836c5bcb 100644 --- a/tests/upgrades/test_role.py +++ b/tests/upgrades/test_role.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest diff --git a/tests/upgrades/test_satellite_maintain.py b/tests/upgrades/test_satellite_maintain.py index 03abb569e94..128a6dd64b2 100644 --- a/tests/upgrades/test_satellite_maintain.py +++ b/tests/upgrades/test_satellite_maintain.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import re import pytest diff --git a/tests/upgrades/test_satellitesync.py b/tests/upgrades/test_satellitesync.py index ad9356d2f97..627f389ca1a 100644 --- a/tests/upgrades/test_satellitesync.py +++ b/tests/upgrades/test_satellitesync.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.constants import PULP_EXPORT_DIR diff --git a/tests/upgrades/test_subnet.py b/tests/upgrades/test_subnet.py index 0fbc2f38277..220b9316c79 100644 --- a/tests/upgrades/test_subnet.py +++ b/tests/upgrades/test_subnet.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest diff --git a/tests/upgrades/test_subscription.py b/tests/upgrades/test_subscription.py index dc6d33b84b2..cbf34dd05a6 100644 --- a/tests/upgrades/test_subscription.py +++ b/tests/upgrades/test_subscription.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from manifester import Manifester import pytest diff --git a/tests/upgrades/test_syncplan.py b/tests/upgrades/test_syncplan.py index 5939c8e16dc..0a9f1e8f787 100644 --- a/tests/upgrades/test_syncplan.py +++ b/tests/upgrades/test_syncplan.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_choice import pytest diff --git a/tests/upgrades/test_user.py b/tests/upgrades/test_user.py index b21da9b5ba1..bdcc3549739 100644 --- a/tests/upgrades/test_user.py +++ b/tests/upgrades/test_user.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest diff --git a/tests/upgrades/test_usergroup.py b/tests/upgrades/test_usergroup.py index 11ac95e2af8..36687f048db 100644 --- a/tests/upgrades/test_usergroup.py +++ b/tests/upgrades/test_usergroup.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/upgrades/test_virtwho.py b/tests/upgrades/test_virtwho.py index e86868ebf37..0e9e15369d9 100644 --- a/tests/upgrades/test_virtwho.py +++ b/tests/upgrades/test_virtwho.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest @@ -148,7 +149,7 @@ def test_post_crud_virt_who_configuration(self, form_data, pre_upgrade_data, tar # Verify the virt-who config-file exists. config_file = get_configure_file(vhd.id) - get_configure_option('hypervisor_id', config_file), + get_configure_option('hypervisor_id', config_file) # Verify Report is sent to satellite. command = get_configure_command(vhd.id, org=org_name) From d8e110e9492a1e3a1bf29231f4f97548670aa310 Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Sun, 5 May 2024 23:57:45 -0400 Subject: [PATCH 07/13] [6.15.z] Bump jinja2 from 3.1.3 to 3.1.4 (#14958) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index e64cceccb20..54258c95c21 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,7 +7,7 @@ cryptography==42.0.5 deepdiff==7.0.1 dynaconf[vault]==3.2.5 fauxfactory==3.1.1 -jinja2==3.1.3 +jinja2==3.1.4 manifester==0.0.14 navmazing==1.2.2 productmd==1.38 From a31cb1e5a99132cd1807be4c14a0c6874487236d Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Mon, 6 May 2024 00:08:30 -0400 Subject: [PATCH 08/13] [6.15.z] Bump cryptography from 42.0.5 to 42.0.6 (#14962) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 54258c95c21..9dab310a859 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ apypie==0.4.0 betelgeuse==1.11.0 broker[docker]==0.4.9 -cryptography==42.0.5 +cryptography==42.0.6 deepdiff==7.0.1 dynaconf[vault]==3.2.5 fauxfactory==3.1.1 From f74838faa24cf62c245c47d955e8542f550ae638 Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Mon, 6 May 2024 04:10:19 -0400 Subject: [PATCH 09/13] [6.15.z] Add test coverage for BZ:2166466 (#14964) --- tests/foreman/destructive/test_ansible.py | 48 +++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/tests/foreman/destructive/test_ansible.py b/tests/foreman/destructive/test_ansible.py index 28f6e932099..f48b7e996b0 100644 --- a/tests/foreman/destructive/test_ansible.py +++ b/tests/foreman/destructive/test_ansible.py @@ -12,6 +12,7 @@ """ +from fauxfactory import gen_string import pytest pytestmark = [pytest.mark.destructive, pytest.mark.upgrade] @@ -69,3 +70,50 @@ def test_positive_import_all_roles(target_sat): # by default should work here. session.ansibleroles.delete('theforeman.foreman_scap_client') assert not session.ansibleroles.search('theforeman.foreman_scap_client') + + +@pytest.mark.parametrize('setting_update', ['entries_per_page=12'], indirect=True) +def test_positive_hostgroup_ansible_roles_tab_pagination(target_sat, setting_update): + """Import all Ansible roles available by default. + + :id: 53fe3857-a08f-493d-93c7-3fed331ed392 + + :steps: + 1. Navigate to the Configure > Roles page, and click the `Import from [hostname]` button + 2. Get total number of importable roles from pagination. + 3. Fill the `Select All` checkbox and click the `Submit` button + 4. Verify that number of imported roles == number of importable roles from step 2 + 5. Navigate to Administer > Settings > General tab and update the entries_per_page setting + 6. Navigate to `Ansible Roles` tab in Hostgroup create and edit page + 7. Verify the new per page entry is updated in pagination list + + :expectedresults: All imported roles should be available on the webUI and properly paginated + as per entries_per_page setting on create and edit hostgroup page. + + :BZ: 2166466, 2242915 + + :customerscenario: true + """ + setting_value = str( + target_sat.api.Setting().search(query={'search': 'name=entries_per_page'})[0].value + ) + with target_sat.ui_session() as session: + imported_roles = session.ansibleroles.import_all_roles() + total_role_count = str(session.ansibleroles.imported_roles_count) + assert imported_roles == int(total_role_count) + assert total_role_count > setting_value + + create_page = session.hostgroup.helper.read_filled_view( + 'New', read_widget_names=['ansible_roles.pagination'] + ) + assert create_page['ansible_roles']['pagination']['_items'].split()[2] == setting_value + assert create_page['ansible_roles']['pagination']['_items'].split()[-2] == total_role_count + + hg = target_sat.api.HostGroup(name=gen_string('alpha')).create() + edit_page = session.hostgroup.helper.read_filled_view( + 'Edit', + navigation_kwargs={'entity_name': hg.name}, + read_widget_names=['ansible_roles.pagination'], + ) + assert edit_page['ansible_roles']['pagination']['_items'].split()[2] == setting_value + assert edit_page['ansible_roles']['pagination']['_items'].split()[-2] == total_role_count From 077f8d9466c1bbbc5180e0a0a7a82e9595ece293 Mon Sep 17 00:00:00 2001 From: vijay sawant Date: Mon, 6 May 2024 18:15:08 +0530 Subject: [PATCH 10/13] 6.15.z update scope of fixtures from hosts-content longrun test_inc_updates (#14843) * 6.15.z update fixtures name from test_inc_updates * changed fixture from sca to non-sca mode --- tests/foreman/longrun/test_inc_updates.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/foreman/longrun/test_inc_updates.py b/tests/foreman/longrun/test_inc_updates.py index 52fd35e3b56..d70613003ed 100644 --- a/tests/foreman/longrun/test_inc_updates.py +++ b/tests/foreman/longrun/test_inc_updates.py @@ -56,9 +56,9 @@ def dev_lce(module_entitlement_manifest_org): @pytest.fixture(scope='module') -def qe_lce(module_sca_manifest_org, dev_lce): +def qe_lce(module_entitlement_manifest_org, dev_lce): return entities.LifecycleEnvironment( - name='QE', prior=dev_lce, organization=module_sca_manifest_org + name='QE', prior=dev_lce, organization=module_entitlement_manifest_org ).create() @@ -229,7 +229,7 @@ def test_positive_noapply_api( @pytest.mark.tier3 -def test_positive_incremental_update_time(module_target_sat, module_sca_manifest_org): +def test_positive_incremental_update_time(module_target_sat, module_entitlement_manifest_org): """Incremental update should not take a long time. :id: a9cdcc58-2d10-42cf-8e24-f7bec3b79d6b @@ -255,7 +255,7 @@ def test_positive_incremental_update_time(module_target_sat, module_sca_manifest """ # create content view cv = module_target_sat.cli_factory.make_content_view( - {'organization-id': module_sca_manifest_org.id} + {'organization-id': module_entitlement_manifest_org.id} ) repo_sync_timestamp = ( datetime.utcnow().replace(microsecond=0) - timedelta(seconds=1) @@ -264,7 +264,7 @@ def test_positive_incremental_update_time(module_target_sat, module_sca_manifest for _repo in ['rhel8_bos', 'rhst8', 'rhsclient8']: rh_repo_id = module_target_sat.api_factory.enable_rhrepo_and_fetchid( basearch=DEFAULT_ARCHITECTURE, - org_id=module_sca_manifest_org.id, + org_id=module_entitlement_manifest_org.id, product=PRDS['rhel8'], repo=REPOS[_repo]['name'], reposet=REPOSET[_repo], @@ -273,7 +273,7 @@ def test_positive_incremental_update_time(module_target_sat, module_sca_manifest module_target_sat.cli.ContentView.add_repository( { 'id': cv['id'], - 'organization-id': module_sca_manifest_org.id, + 'organization-id': module_entitlement_manifest_org.id, 'repository-id': rh_repo_id, } ) From 722315c7e43d619434151dab60906afaf585d10c Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Mon, 6 May 2024 09:20:48 -0400 Subject: [PATCH 11/13] [6.15.z] Copy config files for FAM to server (#14971) --- conf/fam.yaml.template | 101 ++++++++++++++++++++++++++++++++ robottelo/constants/__init__.py | 4 +- robottelo/hosts.py | 9 ++- tests/foreman/sys/test_fam.py | 30 ++++------ 4 files changed, 123 insertions(+), 21 deletions(-) create mode 100644 conf/fam.yaml.template diff --git a/conf/fam.yaml.template b/conf/fam.yaml.template new file mode 100644 index 00000000000..079225d0048 --- /dev/null +++ b/conf/fam.yaml.template @@ -0,0 +1,101 @@ +FAM: + SERVER: + # Parameter for all tests + foreman_username: admin + foreman_password: "changeme" + foreman_server_url: "https://foreman.example.com" + foreman_validate_certs: false + + foreman_proxy: "foreman.example.com" + + # Parameter for snapshot test + snapshot_host_name: "test_host" + + # Parameter for job invocation test + foreman_host: "foreman.example.com" + + # Parameter for subscription_manifest test + subscription_manifest_path: "data/manifest_foreman-ansible-modules.zip" + + # Parameter for redhat_manifest test + manifest_name: "katello.example.com" + rhsm_username: "john-smith" + rhsm_password: "changeme" + rhsm_pool_id: 8a85f99a7db4827d017dc512fcad00b0 + rhsm_validate_certs: false + + # Parameter for scc_product test + scc_account_name_for_scc_product: testaccount + scc_account_login_for_scc_product: testuser + scc_account_password_for_scc_product: testpass + + # Parameter for external_usergroup testing + auth_source_ldap_host: ldap.example.com + auth_source_ldap_account: ansible + auth_source_ldap_account_password: pass + auth_source_ldap_base_dn: dc=example,dc=com + auth_source_ldap_attr_login: uid + auth_source_ldap_groups_base: cn=groups,cn=accounts,dc=example,dc=com + external_usergroup_name: "admins" + + COMPUTE_PROFILE: + libvirt: + compute_resource: + name: libvirt-cr01 + organizations: + - Test Organization + locations: + - Test Location + params: + url: qemu+ssh://libvirtuser@localhost/system + compute_profile: + name: app-small + attrs: + cpus: 1 + memory: 2147483648 + nics_attributes: + 0: + type: bridge + bridge: "" + model: virtio + volumes_attributes: + 0: + pool_name: default + capacity: 10G + allocation: 0G + format_type: raw + ovirt: + compute_resource: + name: ovirt-cr01 + organizations: + - Test Organization + locations: + - Test Location + params: + url: "https://ovirt.example.com/ovirt-engine/api" + user: compute-user@internal + password: ovirtcompute123 + use_v4: true + datacenter: c1479626-99a2-44eb-8401-14b5630f417f + ovirt_quota: 502a76bb-a3fe-42f1-aed6-2a7c892a6786 + compute_profile: + name: app-small + attrs: + cluster: Devel-Infra + cores: 2 + sockets: 1 + memory: 1073741824 + ha: 0 + interfaces_attributes: + 0: + name: "" + network: ovirtmgmt + interface: virtio + volumes_attributes: + 0: + size_gb: '16' + storage_domain: 'Local-IBM' + preallocate: '1' + wipe_after_delete: '0' + interface: 'virtio_scsi' + bootable: 'true' diff --git a/robottelo/constants/__init__.py b/robottelo/constants/__init__.py index 3de512fb4a0..466e45772d6 100644 --- a/robottelo/constants/__init__.py +++ b/robottelo/constants/__init__.py @@ -1885,7 +1885,6 @@ class Colored(Box): "content_export_repository", "content_export_version", "content_rhel_role", - "content_upload_ostree", "content_upload", "content_view_filter_info", "content_view_filter_rule_info", @@ -1946,9 +1945,9 @@ class Colored(Box): "puppet_environment", "realm", "redhat_manifest", + "registration_command", "repositories_role", "repository_info", - "repository_ostree", "repository_set_info", "repository_set", "repository_sync", @@ -1975,6 +1974,7 @@ class Colored(Box): "usergroup", "user", "wait_for_task", + "webhook", ] FAM_ROOT_DIR = '/usr/share/ansible/collections/ansible_collections/redhat/satellite' diff --git a/robottelo/hosts.py b/robottelo/hosts.py index 3c6e2771c90..e5778b57c0b 100644 --- a/robottelo/hosts.py +++ b/robottelo/hosts.py @@ -883,12 +883,17 @@ def get(self, remote_path, local_path=None): """Get a remote file from the broker virtual machine.""" self.session.sftp_read(source=remote_path, destination=local_path) - def put(self, local_path, remote_path=None): + def put(self, local_path, remote_path=None, temp_file=False): """Put a local file to the broker virtual machine. If local_path is a manifest object, write its contents to a temporary file then continue with the upload. """ - if 'utils.manifest' in str(local_path): + if temp_file: + with NamedTemporaryFile(dir=robottelo_tmp_dir) as content_file: + content_file.write(str.encode(local_path)) + content_file.flush() + self.session.sftp_write(source=content_file.name, destination=remote_path) + elif 'utils.manifest' in str(local_path): with NamedTemporaryFile(dir=robottelo_tmp_dir) as content_file: content_file.write(local_path.content.read()) content_file.flush() diff --git a/tests/foreman/sys/test_fam.py b/tests/foreman/sys/test_fam.py index e4675d4f581..a797c39d792 100644 --- a/tests/foreman/sys/test_fam.py +++ b/tests/foreman/sys/test_fam.py @@ -46,6 +46,19 @@ def setup_fam(module_target_sat, module_sca_manifest): # Execute AAP WF for FAM setup Broker().execute(workflow='fam-test-setup', source_vm=module_target_sat.name) + # Setup provisioning resources and copy config files to the Satellite + module_target_sat.configure_libvirt_cr() + module_target_sat.put( + settings.fam.server.to_yaml(), + f'{FAM_ROOT_DIR}/tests/test_playbooks/vars/server.yml', + temp_file=True, + ) + module_target_sat.put( + settings.fam.compute_profile.to_yaml(), + f'{FAM_ROOT_DIR}/tests/test_playbooks/vars/compute_profile.yml', + temp_file=True, + ) + # Edit Makefile to not try to rebuild the collection when tests run module_target_sat.execute(f"sed -i '/^live/ s/$(MANIFEST)//' {FAM_ROOT_DIR}/Makefile") @@ -54,27 +67,10 @@ def setup_fam(module_target_sat, module_sca_manifest): module_target_sat.execute( f'mv {module_sca_manifest.name} {FAM_ROOT_DIR}/tests/test_playbooks/data' ) - - # Edit config file config_file = f'{FAM_ROOT_DIR}/tests/test_playbooks/vars/server.yml' - module_target_sat.execute( - f'cp {FAM_ROOT_DIR}/tests/test_playbooks/vars/server.yml.example {config_file}' - ) - module_target_sat.execute( - f'sed -i "s/foreman.example.com/{module_target_sat.hostname}/g" {config_file}' - ) - module_target_sat.execute( - f'sed -i "s/rhsm_pool_id:.*/rhsm_pool_id: {settings.subscription.rhn_poolid}/g" {config_file}' - ) - module_target_sat.execute( - f'''sed -i 's/rhsm_username:.*/rhsm_username: "{settings.subscription.rhn_username}"/g' {config_file}''' - ) module_target_sat.execute( f'''sed -i 's|subscription_manifest_path:.*|subscription_manifest_path: "data/{module_sca_manifest.name}"|g' {config_file}''' ) - module_target_sat.execute( - f'''sed -i 's/rhsm_password:.*/rhsm_password: "{settings.subscription.rhn_password}"/g' {config_file}''' - ) @pytest.mark.pit_server From b66e114a8dc31d302dec7ed021e807da0c82b76a Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Tue, 7 May 2024 00:05:22 -0400 Subject: [PATCH 12/13] [6.15.z] Bump cryptography from 42.0.6 to 42.0.7 (#14980) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 9dab310a859..09edce7b174 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ apypie==0.4.0 betelgeuse==1.11.0 broker[docker]==0.4.9 -cryptography==42.0.6 +cryptography==42.0.7 deepdiff==7.0.1 dynaconf[vault]==3.2.5 fauxfactory==3.1.1 From ea331534b0a92f7b5744a2deab605f1d23927297 Mon Sep 17 00:00:00 2001 From: Peter Ondrejka Date: Tue, 7 May 2024 11:25:34 +0200 Subject: [PATCH 13/13] [6.15.z] make oscap tests run on rhel9 backend (#14716) (#14983) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit make oscap tests run on rhel9 backend (#14716) Co-authored-by: Ondřej Gajdušek Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- conf/oscap.yaml.template | 6 ++++-- pytest_fixtures/component/oscap.py | 5 ++--- robottelo/constants/__init__.py | 4 +++- tests/foreman/cli/test_oscap.py | 15 ++++++++++----- tests/foreman/ui/test_oscapcontent.py | 12 ------------ 5 files changed, 19 insertions(+), 23 deletions(-) diff --git a/conf/oscap.yaml.template b/conf/oscap.yaml.template index f23ec46ffb9..add2477848e 100644 --- a/conf/oscap.yaml.template +++ b/conf/oscap.yaml.template @@ -1,4 +1,6 @@ OSCAP: - CONTENT_PATH: /usr/share/xml/scap/ssg/content/ssg-rhel7-ds.xml + RHEL_MAJOR_VERSION: "@jinja {{this.server.version.rhel_version | int }}" + CONTENT_PATH: '@format /usr/share/xml/scap/ssg/content/ssg-rhel{this.oscap.rhel_major_version}-ds.xml' # see: robottelo/constants/__init__.py OSCAP_PROFILE - PROFILE: security7 + PROFILE: '@format security{this.oscap.rhel_major_version}' + CONTENT_DIR: /usr/share/xml/scap/ssg/content diff --git a/pytest_fixtures/component/oscap.py b/pytest_fixtures/component/oscap.py index 786788914f2..07dfd7a51e6 100644 --- a/pytest_fixtures/component/oscap.py +++ b/pytest_fixtures/component/oscap.py @@ -5,7 +5,7 @@ import pytest from robottelo.config import robottelo_tmp_dir, settings -from robottelo.constants import OSCAP_PROFILE, OSCAP_TAILORING_FILE, DataFile +from robottelo.constants import OSCAP_TAILORING_FILE, DataFile @pytest.fixture(scope="session") @@ -35,11 +35,10 @@ def scap_content(import_ansible_roles, module_target_sat): ) scap_id = scap_info['id'] scap_info = entities.ScapContents(id=scap_id).read() - scap_profile_id = [ profile['id'] for profile in scap_info.scap_content_profiles - if OSCAP_PROFILE[settings.oscap.profile] in profile['title'] + if module_target_sat.OSCAP['dsrhel'] in profile['title'] ][0] return { "title": title, diff --git a/robottelo/constants/__init__.py b/robottelo/constants/__init__.py index 466e45772d6..6c15441a567 100644 --- a/robottelo/constants/__init__.py +++ b/robottelo/constants/__init__.py @@ -1581,6 +1581,7 @@ class Colored(Box): 'rhel6_content': 'Red Hat rhel6 default content', 'rhel7_content': 'Red Hat rhel7 default content', 'rhel8_content': 'Red Hat rhel8 default content', + 'rhel9_content': 'Red Hat rhel9 default content', 'rhel_firefox': 'Red Hat firefox default content', } @@ -1588,7 +1589,8 @@ class Colored(Box): 'c2s_rhel6': 'C2S for Red Hat Enterprise Linux 6', 'dsrhel6': 'DISA STIG for Red Hat Enterprise Linux 6', 'dsrhel7': 'DISA STIG for Red Hat Enterprise Linux 7', - 'dsrhel8': '[DRAFT] DISA STIG for Red Hat Enterprise Linux 8', + 'dsrhel8': 'DISA STIG for Red Hat Enterprise Linux 8', + 'dsrhel9': 'DISA STIG for Red Hat Enterprise Linux 9', 'esp': 'Example Server Profile', 'rhccp': 'Red Hat Corporate Profile for Certified Cloud Providers (RH CCP)', 'firefox': 'Mozilla Firefox STIG', diff --git a/tests/foreman/cli/test_oscap.py b/tests/foreman/cli/test_oscap.py index 09b3d1c9546..ea0f15318a1 100644 --- a/tests/foreman/cli/test_oscap.py +++ b/tests/foreman/cli/test_oscap.py @@ -68,8 +68,7 @@ def test_positive_list_default_content_with_admin(self, module_target_sat): :CaseImportance: Medium """ scap_contents = [content['title'] for content in module_target_sat.cli.Scapcontent.list()] - for title in OSCAP_DEFAULT_CONTENT.values(): - assert title in scap_contents + assert f'Red Hat rhel{module_target_sat.os_version.major} default content' in scap_contents @pytest.mark.tier1 def test_negative_list_default_content_with_viewer_role( @@ -296,7 +295,9 @@ def test_positive_create_scap_content_with_valid_originalfile_name( @pytest.mark.parametrize('name', **parametrized(invalid_names_list())) @pytest.mark.tier1 def test_negative_create_scap_content_with_invalid_originalfile_name( - self, name, module_target_sat + self, + name, + module_target_sat, ): """Create scap-content with invalid original file name @@ -355,7 +356,10 @@ def test_negative_create_scap_content_without_dsfile(self, title, module_target_ module_target_sat.cli_factory.scapcontent({'title': title}) @pytest.mark.tier1 - def test_positive_update_scap_content_with_newtitle(self, module_target_sat): + def test_positive_update_scap_content_with_newtitle( + self, + module_target_sat, + ): """Update scap content title :id: 2c32e94a-237d-40b9-8a3b-fca2ef26fe79 @@ -921,7 +925,8 @@ def test_positive_update_scap_policy_with_content(self, scap_content, module_tar ) assert scap_policy['scap-content-id'] == scap_content["scap_id"] scap_id, scap_profile_id = self.fetch_scap_and_profile_id( - OSCAP_DEFAULT_CONTENT['rhel_firefox'], module_target_sat + OSCAP_DEFAULT_CONTENT[f'rhel{module_target_sat.os_version.major}_content'], + module_target_sat, ) module_target_sat.cli.Scappolicy.update( {'name': name, 'scap-content-id': scap_id, 'scap-content-profile-id': scap_profile_id} diff --git a/tests/foreman/ui/test_oscapcontent.py b/tests/foreman/ui/test_oscapcontent.py index a87abb91e75..cb580c4c857 100644 --- a/tests/foreman/ui/test_oscapcontent.py +++ b/tests/foreman/ui/test_oscapcontent.py @@ -12,24 +12,12 @@ """ -import os - import pytest -from robottelo.config import robottelo_tmp_dir, settings from robottelo.constants import DataFile from robottelo.utils.datafactory import gen_string -@pytest.fixture(scope='module') -def oscap_content_path(module_target_sat): - _, file_name = os.path.split(settings.oscap.content_path) - - local_file = robottelo_tmp_dir.joinpath(file_name) - module_target_sat.get(remote_path=settings.oscap.content_path, local_path=str(local_file)) - return local_file - - @pytest.mark.skip_if_open("BZ:2167937") @pytest.mark.skip_if_open("BZ:2133151") @pytest.mark.tier1