def test_negative_synchronize_auth_yum_repo(self): """Check if secured repo fails to synchronize with invalid credentials @id: 809905ae-fb76-465d-9468-1f99c4274aeb @Assert: Repository is created but synchronization fails @CaseLevel: Integration """ url = FAKE_5_YUM_REPO for creds in [cred for cred in valid_http_credentials(url_encoded=True) if not cred['http_valid']]: url_encoded = url.format( creds['login'], creds['pass'] ) with self.subTest(url): new_repo = self._make_repository({ u'content-type': u'yum', u'url': url_encoded, }) # Try to synchronize it repo_sync = Repository.synchronize( {'id': new_repo['id'], u'async': True} ) Task.progress({u'id': repo_sync[0]['id']}) self.assertEqual( Task.progress({u'id': repo_sync[0]['id']})[0], u'Yum Metadata: Unauthorized' )
def test_negative_synchronize_auth_yum_repo(self): """Check if secured repo fails to synchronize with invalid credentials @id: 809905ae-fb76-465d-9468-1f99c4274aeb @Assert: Repository is created but synchronization fails @CaseLevel: Integration """ url = FAKE_5_YUM_REPO for creds in [ cred for cred in valid_http_credentials(url_encoded=True) if not cred['http_valid'] ]: url_encoded = url.format(creds['login'], creds['pass']) with self.subTest(url): new_repo = self._make_repository({ u'content-type': u'yum', u'url': url_encoded, }) # Try to synchronize it repo_sync = Repository.synchronize({ 'id': new_repo['id'], u'async': True }) Task.progress({u'id': repo_sync[0]['id']}) self.assertEqual( Task.progress({u'id': repo_sync[0]['id']})[0], u'Yum Metadata: Unauthorized')
def test_negative_synchronize_auth_yum_repo(self): """Check if secured repo fails to synchronize with invalid credentials @id: 809905ae-fb76-465d-9468-1f99c4274aeb @Assert: Repository is created but synchronization fails @CaseLevel: Integration """ url = FAKE_5_YUM_REPO for creds in [cred for cred in valid_http_credentials(url_encoded=True) if not cred["http_valid"]]: url_encoded = url.format(creds["login"], creds["pass"]) with self.subTest(url): new_repo = self._make_repository({u"content-type": u"yum", u"url": url_encoded}) # Try to synchronize it repo_sync = Repository.synchronize({"id": new_repo["id"], u"async": True}) Task.progress({u"id": repo_sync[0]["id"]}) self.assertEqual(Task.progress({u"id": repo_sync[0]["id"]})[0], u"Yum Metadata: Unauthorized")
def test_install_errata_to_one_host(module_org, errata_hosts, host_collection): """Install an erratum to one of the hosts in a host collection. :id: bfcee2de-3448-497e-a696-fcd30cea9d33 :expectedresults: Errata was successfully installed in only one of the hosts in the host collection :Setup: Errata synced on satellite server, custom package installed on errata hosts. :Steps: 1. Remove packages from one host. 2. host-collection erratum install --errata <errata> --id <id> --organization <org_name> 3. Assert first host does not have the package. 4. Assert second host does have the new package. :expectedresults: Erratum is only installed on one host. :BZ: 1810774 """ errata = REPO_WITH_ERRATA['errata'][0] # Remove the package on first host to remove need for errata. result = errata_hosts[0].execute(f'yum erase -y {errata["package_name"]}') assert result.status == 0, f'Failed to erase the rpm: {result.stdout}' # Apply errata to the host collection. install_task = HostCollection.erratum_install({ 'id': host_collection['id'], 'organization': module_org.name, 'errata': [errata['id']], }) Task.progress({'id': install_task[0]['id']}) assert not is_rpm_installed( errata_hosts[0], rpm=errata['package_name']), 'Package should not be installed on host.' assert is_rpm_installed( errata_hosts[1], rpm=errata['new_package']), 'Package should be installed on host.'
def test_positive_install_by_host_collection_and_org(module_org, host_collection, errata_hosts, filter_by_hc, filter_by_org): """Use host collection id or name and org id, name, or label to install an update on the host collection. :id: 1b063f76-c85f-42fb-a919-5de319b09b99 :parametrized: yes :Setup: Errata synced on satellite server. :Steps: host-collection erratum install --errata <errata> (--id <hc_id>|--name <hc_name>) (--organization-id <org_id>|--organization <org_name>|--organization-label <org_label>) :expectedresults: Erratum is installed. :CaseLevel: System :BZ: 1457977 """ param = {'errata': [REPO_WITH_ERRATA['errata'][0]['id']]} if filter_by_hc == 'id': param['id'] = host_collection['id'] elif filter_by_hc == 'name': param['name'] = host_collection['name'] if filter_by_org == 'id': param['organization-id'] = module_org.id elif filter_by_org == 'name': param['organization'] = module_org.name elif filter_by_org == 'label': param['organization-label'] = module_org.label install_task = HostCollection.erratum_install(param) Task.progress({'id': install_task[0]['id']}) for host in errata_hosts: assert is_rpm_installed(host)