diff --git a/tests/foreman/api/test_errata.py b/tests/foreman/api/test_errata.py index 5207470035d..169e5f9d8ff 100644 --- a/tests/foreman/api/test_errata.py +++ b/tests/foreman/api/test_errata.py @@ -75,28 +75,13 @@ def custom_repo(module_org, module_lce, module_cv, activation_key): ) -def _install_package( - module_org, clients, host_ids, package_name, via_ssh=True, rpm_package_name=None -): - """Install package via SSH CLI if via_ssh is True, otherwise - install via http api: PUT /api/v2/hosts/bulk/install_content - """ - if via_ssh: - for client in clients: - result = client.run(f'yum install -y {package_name}') - assert result.status == 0 - result = client.run(f'rpm -q {package_name}') - assert result.status == 0 - else: - entities.Host().install_content( - data={ - 'organization_id': module_org.id, - 'included': {'ids': host_ids}, - 'content_type': 'package', - 'content': [package_name], - } - ) - _validate_package_installed(clients, rpm_package_name) +def _install_package(clients, package_name): + """Install package via SSH""" + for client in clients: + result = client.run(f'yum install -y {package_name}') + assert result.status == 0 + result = client.run(f'rpm -q {package_name}') + assert result.status == 0 def _validate_package_installed(hosts, package_name, expected_installed=True, timeout=240): @@ -250,20 +235,17 @@ def test_positive_install_multiple_in_host( } ) rhel_contenthost.install_katello_ca(module_target_sat) - rhel_contenthost.register_contenthost(function_org.name, activation_key.name) + rhel_contenthost.register_contenthost(function_org.name, activation_key.name, function_lce.name) rhel_contenthost.run(r'subscription-manager repos --enable \*') rhel_contenthost.install_katello_ca(module_target_sat) - + assert rhel_contenthost.subscribed - host = rhel_contenthost.nailgun_host for package in constants.FAKE_9_YUM_OUTDATED_PACKAGES: - _install_package( - function_org, clients=[rhel_contenthost], host_ids=[host.id], package_name=package - ) + _install_package(clients=[rhel_contenthost], package_name=package) applicable_errata_count = rhel_contenthost.applicable_errata_count assert applicable_errata_count > 1 rhel_contenthost.add_rex_key(satellite=module_target_sat) - for errata in settings.repos.yum_9.errata[1:4]: + for errata in settings.repos.yum_9.errata: task_id = module_target_sat.api.JobInvocation().run( data={ 'feature': 'katello_errata_install',