def setUpClass(cls): """Create necessary objects which can be re-used in tests.""" super(DockerActivationKeyTestCase, cls).setUpClass() cls.org = make_org() cls.lce = make_lifecycle_environment({ 'organization-id': cls.org['id'], }) cls.product = make_product({ 'organization-id': cls.org['id'], }) cls.repo = _make_docker_repo(cls.product['id']) cls.content_view = make_content_view({ 'composite': False, 'organization-id': cls.org['id'], }) ContentView.add_repository({ 'id': cls.content_view['id'], 'repository-id': cls.repo['id'], }) cls.content_view = ContentView.info({ 'id': cls.content_view['id'] }) ContentView.publish({'id': cls.content_view['id']}) cls.content_view = ContentView.info({ 'id': cls.content_view['id']}) cls.cvv = ContentView.version_info({ 'id': cls.content_view['versions'][0]['id'], }) ContentView.version_promote({ 'id': cls.content_view['versions'][0]['id'], 'lifecycle-environment-id': cls.lce['id'], }) cls.cvv = ContentView.version_info({ 'id': cls.content_view['versions'][0]['id'], })
def test_add_docker_repo_to_composite_content_view(self): """@Test: Add one Docker-type repository to a composite content view @Assert: A repository is created with a Docker repository and the product is added to a content view which is then added to a composite content view. @Feature: Docker """ self._create_and_associate_repo_with_cv() ContentView.publish({'id': self.content_view['id']}) self.content_view = ContentView.info({ 'id': self.content_view['id']}) self.assertEqual(len(self.content_view['versions']), 1) comp_content_view = make_content_view({ 'composite': True, 'organization-id': self.org_id, }) ContentView.update({ 'id': comp_content_view['id'], 'component-ids': self.content_view['versions'][0]['id'], }) comp_content_view = ContentView.info({ 'id': comp_content_view['id'], }) self.assertIn( self.content_view['versions'][0]['id'], [component['id'] for component in comp_content_view['components']], )
def setup_content_view(self, org_id, lce_id=None): # type: (int, int) -> Tuple[Dict, Dict] """Setup organization content view by adding all the repositories, publishing and promoting to lce if needed. """ if lce_id is None: lce = make_lifecycle_environment({'organization-id': org_id}) else: lce = LifecycleEnvironment.info({ 'id': lce_id, 'organization-id': org_id, }) content_view = make_content_view({'organization-id': org_id}) # Add repositories to content view for repo in self: repo.add_to_content_view(org_id, content_view['id']) # Publish the content view ContentView.publish({'id': content_view['id']}) if lce['name'] != ENVIRONMENT: # Get the latest content view version id content_view_version = ContentView.info({ 'id': content_view['id'] })['versions'][-1] # Promote content view version to lifecycle environment ContentView.version_promote({ 'id': content_view_version['id'], 'organization-id': org_id, 'to-lifecycle-environment-id': lce['id'], }) content_view = ContentView.info({'id': content_view['id']}) return content_view, lce
def setup_content_view(self, org_id, lce_id=None): # type: (int, int) -> Tuple[Dict, Dict] """Setup organization content view by adding all the repositories, publishing and promoting to lce if needed. """ if lce_id is None: lce = make_lifecycle_environment({'organization-id': org_id}) else: lce = LifecycleEnvironment.info({ 'id': lce_id, 'organization-id': org_id, }) content_view = make_content_view({'organization-id': org_id}) # Add repositories to content view for repo in self: repo.add_to_content_view(org_id, content_view['id']) # Publish the content view ContentView.publish({'id': content_view['id']}) if lce['name'] != ENVIRONMENT: # Get the latest content view version id content_view_version = ContentView.info({'id': content_view['id'] })['versions'][-1] # Promote content view version to lifecycle environment ContentView.version_promote({ 'id': content_view_version['id'], 'organization-id': org_id, 'to-lifecycle-environment-id': lce['id'], }) content_view = ContentView.info({'id': content_view['id']}) return content_view, lce
def test_promote_multiple_docker_repo_composite_content_view(self): """@Test: Add Docker-type repository to composite content view and publish it. Then promote it to the multiple available lifecycle-environments. @Assert: Docker-type repository is promoted to content view found in the specific lifecycle-environments. @Feature: Docker """ self._create_and_associate_repo_with_cv() ContentView.publish({'id': self.content_view['id']}) self.content_view = ContentView.info({ 'id': self.content_view['id']}) self.assertEqual(len(self.content_view['versions']), 1) comp_content_view = make_content_view({ 'composite': True, 'organization-id': self.org_id, }) ContentView.update({ 'component-ids': self.content_view['versions'][0]['id'], 'id': comp_content_view['id'], }) comp_content_view = ContentView.info({ 'id': comp_content_view['id'], }) self.assertIn( self.content_view['versions'][0]['id'], [ component['id'] for component in comp_content_view['components'] ], ) ContentView.publish({'id': comp_content_view['id']}) comp_content_view = ContentView.info({ 'id': comp_content_view['id'], }) cvv = ContentView.version_info({ 'id': comp_content_view['versions'][0]['id'], }) self.assertEqual(len(cvv['lifecycle-environments']), 1) for i in range(1, randint(3, 6)): lce = make_lifecycle_environment({'organization-id': self.org_id}) ContentView.version_promote({ 'id': comp_content_view['versions'][0]['id'], 'lifecycle-environment-id': lce['id'], }) cvv = ContentView.version_info({ 'id': comp_content_view['versions'][0]['id'], }) self.assertEqual(len(cvv['lifecycle-environments']), i+1)
def test_add_multiple_docker_repos_to_composite_content_view(self): """@Test: Add multiple Docker-type repositories to a composite content view. @Assert: One repository is created with a Docker image and the product is added to a random number of content views which are then added to a composite content view. @Feature: Docker """ cv_versions = [] product = make_product({'organization-id': self.org_id}) for _ in range(randint(2, 5)): content_view = make_content_view({ 'composite': False, 'organization-id': self.org_id, }) repo = _make_docker_repo(product['id']) result = ContentView.add_repository({ 'id': content_view['id'], 'repository-id': repo['id'], }) self.assertEqual(result.return_code, 0) result = ContentView.publish({'id': content_view['id']}) self.assertEqual(result.return_code, 0) content_view = ContentView.info({'id': content_view['id']}).stdout self.assertEqual(len(content_view['versions']), 1) cv_versions.append(content_view['versions'][0]) comp_content_view = make_content_view({ 'composite': True, 'organization-id': self.org_id, }) cv_versions_ids = ','.join( cv_version['id'] for cv_version in cv_versions) result = ContentView.update({ 'component-ids': cv_versions_ids, 'id': comp_content_view['id'], }) self.assertEqual(result.return_code, 0) comp_content_view = ContentView.info({ 'id': comp_content_view['id'], }).stdout for cv_version in cv_versions: self.assertIn( cv_version['id'], [ component['id'] for component in comp_content_view['components'] ], )
def test_add_docker_repo_composite_view_to_activation_key(self): """@Test: Add Docker-type repository to a non-composite content view and publish it. Then add this content view to a composite content view and publish it. Create an activation key and associate it with the composite Docker content view. @Assert: Docker-based content view can be added to activation key @Feature: Docker """ comp_content_view = make_content_view({ 'composite': True, 'organization-id': self.org['id'], }) ContentView.update({ 'component-ids': self.content_view['versions'][0]['id'], 'id': comp_content_view['id'], }) comp_content_view = ContentView.info({ 'id': comp_content_view['id'], }) self.assertIn( self.content_view['versions'][0]['id'], [ component['id'] for component in comp_content_view['components'] ], ) ContentView.publish({'id': comp_content_view['id']}) comp_content_view = ContentView.info({ 'id': comp_content_view['id'], }) comp_cvv = ContentView.version_info({ 'id': comp_content_view['versions'][0]['id'], }) ContentView.version_promote({ 'id': comp_cvv['id'], 'lifecycle-environment-id': self.lce['id'], }) activation_key = make_activation_key({ 'content-view-id': comp_content_view['id'], 'lifecycle-environment-id': self.lce['id'], 'organization-id': self.org['id'], }) self.assertEqual( activation_key['content-view'], comp_content_view['name'])
def test_promote_docker_repo_content_view(self): """@Test: Add Docker-type repository to content view and publish it. Then promote it to the next available lifecycle-environment. @Assert: Docker-type repository is promoted to content view found in the specific lifecycle-environment. @Feature: Docker """ lce = make_lifecycle_environment({'organization-id': self.org_id}) self._create_and_associate_repo_with_cv() ContentView.publish({'id': self.content_view['id']}) self.content_view = ContentView.info({ 'id': self.content_view['id']}) self.assertEqual(len(self.content_view['versions']), 1) cvv = ContentView.version_info({ 'id': self.content_view['versions'][0]['id'], }) self.assertEqual(len(cvv['lifecycle-environments']), 1) ContentView.version_promote({ 'id': cvv['id'], 'lifecycle-environment-id': lce['id'], }) cvv = ContentView.version_info({ 'id': self.content_view['versions'][0]['id'], }) self.assertEqual(len(cvv['lifecycle-environments']), 2)
def _create_and_associate_repo_with_cv(self): """Create a Docker-based repository and content view and associate them. """ self.repo = _make_docker_repo( make_product({'organization-id': self.org_id})['id']) self.content_view = make_content_view({ 'composite': False, 'organization-id': self.org_id, }) ContentView.add_repository({ 'id': self.content_view['id'], 'repository-id': self.repo['id'], }) self.content_view = ContentView.info({ 'id': self.content_view['id'] }) self.assertIn( self.repo['id'], [ repo_['id'] for repo_ in self.content_view['docker-repositories'] ], )
def test_positive_update_aks_to_chost(self): """Check if multiple Activation keys can be attached to a Content host @Feature: Activation key - Content host @Assert: Multiple Activation keys are attached to a Content host """ env = make_lifecycle_environment({u'organization-id': self.org['id']}) new_cv = make_content_view({u'organization-id': self.org['id']}) ContentView.publish({u'id': new_cv['id']}) cvv = ContentView.info({u'id': new_cv['id']})['versions'][0] ContentView.version_promote({ u'id': cvv['id'], u'to-lifecycle-environment-id': env['id'], }) new_aks = [ make_activation_key({ u'lifecycle-environment-id': env['id'], u'content-view': new_cv['name'], u'organization-id': self.org['id'], }) for _ in range(2) ] with VirtualMachine(distro='rhel65') as vm: vm.install_katello_ca() for i in range(2): result = vm.register_contenthost( new_aks[i]['name'], self.org['label']) self.assertEqual(result.return_code, 0)
def setUp(self): """ Tests for Content Host via Hammer CLI """ super(TestContentHost, self).setUp() if TestContentHost.NEW_ORG is None: TestContentHost.NEW_ORG = make_org() if TestContentHost.NEW_LIFECYCLE is None: TestContentHost.NEW_LIFECYCLE = make_lifecycle_environment( {u'organization-id': TestContentHost.NEW_ORG['id']} ) if TestContentHost.LIBRARY is None: library_result = LifecycleEnvironment.info( {u'organization-id': TestContentHost.NEW_ORG['id'], u'name': u'Library'} ) TestContentHost.LIBRARY = library_result.stdout if TestContentHost.DEFAULT_CV is None: cv_result = ContentView.info( {u'organization-id': TestContentHost.NEW_ORG['id'], u'name': u'Default Organization View'} ) TestContentHost.DEFAULT_CV = cv_result.stdout
def setup_content(request): """Pytest fixture for setting up an organization, manifest, content-view, lifecycle environment, and activation key with subscriptions""" org = make_org() with manifests.clone() as manifest: upload_file(manifest.content, manifest.filename) new_product = make_product({'organization-id': org['id']}) new_repo = make_repository({'product-id': new_product['id']}) Repository.synchronize({'id': new_repo['id']}) content_view = make_content_view({'organization-id': org['id']}) ContentView.add_repository( {'id': content_view['id'], 'organization-id': org['id'], 'repository-id': new_repo['id']} ) ContentView.publish({'id': content_view['id']}) env = make_lifecycle_environment({'organization-id': org['id']}) cvv = ContentView.info({'id': content_view['id']})['versions'][0] ContentView.version_promote({'id': cvv['id'], 'to-lifecycle-environment-id': env['id']}) new_ak = make_activation_key( { 'lifecycle-environment-id': env['id'], 'content-view': content_view['name'], 'organization-id': org['id'], 'auto-attach': False, } ) subs_id = Subscription.list({'organization-id': org['id']}, per_page=False) ActivationKey.add_subscription({'id': new_ak['id'], 'subscription-id': subs_id[0]['id']}) request.cls.setup_org = org request.cls.setup_new_ak = new_ak request.cls.setup_subs_id = subs_id request.cls.setup_env = env request.cls.setup_content_view = content_view
def test_positive_update_lce(self): """Update Environment in an Activation key @Feature: Activation key - Positive Update @Assert: Activation key is updated """ ak_env = self._make_activation_key({ u'lifecycle-environment-id': self.get_default_env()['id'], }) env = make_lifecycle_environment({u'organization-id': self.org['id']}) new_cv = make_content_view({u'organization-id': self.org['id']}) ContentView.publish({u'id': new_cv['id']}) cvv = ContentView.info({u'id': new_cv['id']})['versions'][0] ContentView.version_promote({ u'id': cvv['id'], u'to-lifecycle-environment-id': env['id'], }) ActivationKey.update({ u'id': ak_env['id'], u'lifecycle-environment-id': env['id'], u'content-view': new_cv['name'], u'organization-id': self.org['id'], }) updated_ak = ActivationKey.info({'id': ak_env['id']}) self.assertEqual(updated_ak['lifecycle-environment'], env['name'])
def test_positive_update_aks_to_chost(self): """Check if multiple Activation keys can be attached to a Content host :id: 24fddd9c-03ae-41a7-8649-72296cbbafdf :expectedresults: Multiple Activation keys are attached to a Content host :CaseLevel: System """ env = make_lifecycle_environment({u'organization-id': self.org['id']}) new_cv = make_content_view({u'organization-id': self.org['id']}) ContentView.publish({u'id': new_cv['id']}) cvv = ContentView.info({u'id': new_cv['id']})['versions'][0] ContentView.version_promote({ u'id': cvv['id'], u'to-lifecycle-environment-id': env['id'], }) new_aks = [ make_activation_key({ u'lifecycle-environment-id': env['id'], u'content-view': new_cv['name'], u'organization-id': self.org['id'], }) for _ in range(2) ] with VirtualMachine(distro=DISTRO_RHEL6) as vm: vm.install_katello_ca() for i in range(2): vm.register_contenthost( self.org['label'], new_aks[i]['name']) self.assertTrue(vm.subscribed)
def test_positive_update_lce(self): """Update Environment in an Activation key :id: 55aaee60-b8c8-49f0-995a-6c526b9b653b :expectedresults: Activation key is updated :CaseLevel: Integration """ ak_env = self._make_activation_key({ u'lifecycle-environment-id': self.get_default_env()['id'], }) env = make_lifecycle_environment({u'organization-id': self.org['id']}) new_cv = make_content_view({u'organization-id': self.org['id']}) ContentView.publish({u'id': new_cv['id']}) cvv = ContentView.info({u'id': new_cv['id']})['versions'][0] ContentView.version_promote({ u'id': cvv['id'], u'to-lifecycle-environment-id': env['id'], }) ActivationKey.update({ u'id': ak_env['id'], u'lifecycle-environment-id': env['id'], u'content-view': new_cv['name'], u'organization-id': self.org['id'], }) updated_ak = ActivationKey.info({'id': ak_env['id']}) self.assertEqual(updated_ak['lifecycle-environment'], env['name'])
def test_positive_export_import_cv(self): """Export CV version contents in directory and Import them. :id: b08e9f24-f18e-43b7-9189-ad7b596ccb5b :steps: 1. Export whole CV version contents to a directory 3. Import those contents from some other org/satellite. :expectedresults: 1. Whole CV version contents has been exported to directory 2. All The exported contents has been imported in org/satellite. :CaseLevel: System """ ContentView.version_export({ 'export-dir': '{}'.format(self.export_dir), 'id': self.exporting_cvv_id }) exported_tar = '{0}/export-{1}.tar'.format(self.export_dir, self.exporting_cvv_id) result = ssh.command("[ -f {0} ]".format(exported_tar)) self.assertEqual(result.return_code, 0) exported_packages = Package.list({'content-view-version-id': self.exporting_cvv_id}) self.set_importing_org(self.exporting_prod, self.exporting_repo, self.exporting_cv) ContentView.version_import({ 'export-tar': exported_tar, 'organization-id': self.importing_org['id'] }) importing_cvv_id = ContentView.info({ u'id': self.importing_cv['id'] })['versions'][0]['id'] imported_packages = Package.list({'content-view-version-id': importing_cvv_id}) self.assertEqual(len(exported_packages), len(imported_packages))
def test_positive_update_lce(self): """@Test: Update Environment in an Activation key @Feature: Activation key - Positive Update @Assert: Activation key is updated """ ak_env = self._make_activation_key({ u'lifecycle-environment-id': self.get_default_env()['id'], }) env = make_lifecycle_environment({u'organization-id': self.org['id']}) new_cv = make_content_view({u'organization-id': self.org['id']}) ContentView.publish({u'id': new_cv['id']}) cvv = ContentView.info({u'id': new_cv['id']})['versions'][0] ContentView.version_promote({ u'id': cvv['id'], u'to-lifecycle-environment-id': env['id'], }) ActivationKey.update({ u'id': ak_env['id'], u'lifecycle-environment-id': env['id'], u'content-view': new_cv['name'], u'organization-id': self.org['id'], }) updated_ak = ActivationKey.info({'id': ak_env['id']}) self.assertEqual(updated_ak['lifecycle-environment'], env['name'])
def test_positive_update_aks_to_chost(self): """Check if multiple Activation keys can be attached to a Content host @Feature: Activation key - Content host @Assert: Multiple Activation keys are attached to a Content host """ env = make_lifecycle_environment({u"organization-id": self.org["id"]}) new_cv = make_content_view({u"organization-id": self.org["id"]}) ContentView.publish({u"id": new_cv["id"]}) cvv = ContentView.info({u"id": new_cv["id"]})["versions"][0] ContentView.version_promote({u"id": cvv["id"], u"to-lifecycle-environment-id": env["id"]}) new_aks = [ make_activation_key( { u"lifecycle-environment-id": env["id"], u"content-view": new_cv["name"], u"organization-id": self.org["id"], } ) for _ in range(2) ] with VirtualMachine(distro="rhel65") as vm: vm.install_katello_ca() for i in range(2): result = vm.register_contenthost(new_aks[i]["name"], self.org["label"]) self.assertEqual(result.return_code, 0)
def test_positive_sync_publish_promote_cv(self): """Synchronize repository with DRPMs, add repository to content view, publish and promote content view to lifecycle environment @id: a01cb12b-d388-4902-8532-714f4e28ec56 @Assert: drpms can be listed in content view in proper lifecycle environment """ lce = make_lifecycle_environment({"organization-id": self.org["id"]}) repo = make_repository({"product-id": self.product["id"], "url": FAKE_YUM_DRPM_REPO}) Repository.synchronize({"id": repo["id"]}) cv = make_content_view({"organization-id": self.org["id"]}) ContentView.add_repository({"id": cv["id"], "repository-id": repo["id"]}) ContentView.publish({"id": cv["id"]}) content_view = ContentView.info({"id": cv["id"]}) cvv = content_view["versions"][0] ContentView.version_promote({"id": cvv["id"], "to-lifecycle-environment-id": lce["id"]}) result = ssh.command( "ls /var/lib/pulp/published/yum/https/repos/{}/{}/{}/custom/{}/{}" "/drpms/ | grep .drpm".format( self.org["label"], lce["label"], cv["label"], self.product["label"], repo["label"] ) ) self.assertEqual(result.return_code, 0) self.assertGreaterEqual(len(result.stdout), 1)
def test_add_multiple_docker_repos_to_content_view(self): """@Test: Add multiple Docker-type repositories to a non-composite content view. @Assert: Repositories are created with Docker images and the product is added to a non-composite content view. @Feature: Docker """ product = make_product({'organization-id': self.org_id}) repos = [ _make_docker_repo(product['id']) for _ in range(randint(2, 5)) ] content_view = make_content_view({ 'composite': False, 'organization-id': self.org_id, }) for repo in repos: result = ContentView.add_repository({ 'id': content_view['id'], 'repository-id': repo['id'], }) self.assertEqual(result.return_code, 0) content_view = ContentView.info({'id': content_view['id']}).stdout self.assertEqual( set([repo['id'] for repo in repos]), set([repo['id'] for repo in content_view['docker-repositories']]), )
def test_add_docker_repo_to_content_view(self): """@Test: Add one Docker-type repository to a non-composite content view @Assert: A repository is created with a Docker repository and the product is added to a non-composite content view @Feature: Docker """ repo = _make_docker_repo( make_product({'organization-id': self.org_id})['id']) content_view = make_content_view({ 'composite': False, 'organization-id': self.org_id, }) result = ContentView.add_repository({ 'id': content_view['id'], 'repository-id': repo['id'], }) self.assertEqual(result.return_code, 0) content_view = ContentView.info({'id': content_view['id']}).stdout self.assertIn( repo['id'], [repo_['id'] for repo_ in content_view['docker-repositories']], )
def test_add_synced_docker_repo_to_content_view(self): """@Test: Create and sync a Docker-type repository @Assert: A repository is created with a Docker repository and it is synchronized. @Feature: Docker """ repo = _make_docker_repo( make_product({'organization-id': self.org_id})['id']) result = Repository.synchronize({'id': repo['id']}) self.assertEqual(result.return_code, 0) repo = Repository.info({'id': repo['id']}).stdout self.assertGreaterEqual( int(repo['content-counts']['docker-images']), 1) content_view = make_content_view({ 'composite': False, 'organization-id': self.org_id, }) result = ContentView.add_repository({ 'id': content_view['id'], 'repository-id': repo['id'], }) self.assertEqual(result.return_code, 0) content_view = ContentView.info({'id': content_view['id']}).stdout self.assertIn( repo['id'], [repo_['id'] for repo_ in content_view['docker-repositories']], )
def setUpClass(cls): """Tests for Content Host via Hammer CLI""" super(ContentHostTestCase, cls).setUpClass() ContentHostTestCase.NEW_ORG = make_org(cached=True) ContentHostTestCase.NEW_LIFECYCLE = make_lifecycle_environment( {u"organization-id": ContentHostTestCase.NEW_ORG["id"]}, cached=True ) ContentHostTestCase.LIBRARY = LifecycleEnvironment.info( {u"organization-id": ContentHostTestCase.NEW_ORG["id"], u"name": u"Library"} ) ContentHostTestCase.DEFAULT_CV = ContentView.info( {u"organization-id": ContentHostTestCase.NEW_ORG["id"], u"name": u"Default Organization View"} ) ContentHostTestCase.NEW_CV = make_content_view({u"organization-id": ContentHostTestCase.NEW_ORG["id"]}) cv_id = ContentHostTestCase.NEW_CV["id"] ContentView.publish({u"id": cv_id}) version_id = ContentView.version_list({u"content-view-id": cv_id})[0]["id"] ContentView.version_promote( { u"id": version_id, u"to-lifecycle-environment-id": ContentHostTestCase.NEW_LIFECYCLE["id"], u"organization-id": ContentHostTestCase.NEW_ORG["id"], } ) ContentHostTestCase.PROMOTED_CV = ContentHostTestCase.NEW_CV
def setUp(self): """Tests for Host Collections via Hammer CLI""" super(HostCollectionTestCase, self).setUp() if HostCollectionTestCase.org is None: HostCollectionTestCase.org = make_org(cached=True) if HostCollectionTestCase.new_lifecycle is None: HostCollectionTestCase.new_lifecycle = make_lifecycle_environment( {u"organization-id": HostCollectionTestCase.org["id"]}, cached=True ) if HostCollectionTestCase.library is None: HostCollectionTestCase.library = LifecycleEnvironment.info( {u"organization-id": HostCollectionTestCase.org["id"], u"name": ENVIRONMENT} ) if HostCollectionTestCase.default_cv is None: HostCollectionTestCase.default_cv = ContentView.info( {u"organization-id": HostCollectionTestCase.org["id"], u"name": DEFAULT_CV} ) if HostCollectionTestCase.new_cv is None: HostCollectionTestCase.new_cv = make_content_view({u"organization-id": HostCollectionTestCase.org["id"]}) HostCollectionTestCase.promoted_cv = None cv_id = HostCollectionTestCase.new_cv["id"] ContentView.publish({u"id": cv_id}) result = ContentView.version_list({u"content-view-id": cv_id}) version_id = result[0]["id"] ContentView.version_promote( { u"id": version_id, u"organization-id": HostCollectionTestCase.org["id"], u"to-lifecycle-environment-id": (HostCollectionTestCase.new_lifecycle["id"]), } ) HostCollectionTestCase.promoted_cv = HostCollectionTestCase.new_cv
def setUpClass(cls): """Tests for Content Host via Hammer CLI""" super(ContentHostTestCase, cls).setUpClass() ContentHostTestCase.NEW_ORG = make_org(cached=True) ContentHostTestCase.NEW_LIFECYCLE = make_lifecycle_environment( {u'organization-id': ContentHostTestCase.NEW_ORG['id']}, cached=True ) ContentHostTestCase.LIBRARY = LifecycleEnvironment.info({ u'organization-id': ContentHostTestCase.NEW_ORG['id'], u'name': u'Library', }) ContentHostTestCase.DEFAULT_CV = ContentView.info({ u'organization-id': ContentHostTestCase.NEW_ORG['id'], u'name': u'Default Organization View', }) ContentHostTestCase.NEW_CV = make_content_view({ u'organization-id': ContentHostTestCase.NEW_ORG['id'], }) cv_id = ContentHostTestCase.NEW_CV['id'] ContentView.publish({u'id': cv_id}) version_id = ContentView.version_list({ u'content-view-id': cv_id, })[0]['id'] ContentView.version_promote({ u'id': version_id, u'to-lifecycle-environment-id': ContentHostTestCase.NEW_LIFECYCLE[ 'id' ], u'organization-id': ContentHostTestCase.NEW_ORG['id'] }) ContentHostTestCase.PROMOTED_CV = ContentHostTestCase.NEW_CV
def test_positive_update_aks_to_chost(self): """@Test: Check if multiple Activation keys can be attached to a Content host @Feature: Activation key - Content host @Assert: Multiple Activation keys are attached to a Content host """ env = make_lifecycle_environment({u'organization-id': self.org['id']}) new_cv = make_content_view({u'organization-id': self.org['id']}) ContentView.publish({u'id': new_cv['id']}) cvv = ContentView.info({u'id': new_cv['id']})['versions'][0] ContentView.version_promote({ u'id': cvv['id'], u'to-lifecycle-environment-id': env['id'], }) new_aks = [ make_activation_key({ u'lifecycle-environment-id': env['id'], u'content-view': new_cv['name'], u'organization-id': self.org['id'], }) for _ in range(2) ] with VirtualMachine(distro='rhel65') as vm: vm.install_katello_ca() for i in range(2): result = vm.register_contenthost( new_aks[i]['name'], self.org['label']) self.assertEqual(result.return_code, 0)
def setUpClass(cls): """Create Directory for all CV Sync Tests in /tmp""" super(ContentViewSync, cls).setUpClass() cls.exporting_org = make_org() cls.exporting_prod = gen_string('alpha') product = make_product({ 'organization-id': cls.exporting_org['id'], 'name': cls.exporting_prod }) cls.exporting_repo = gen_string('alpha') repo = make_repository({ 'name': cls.exporting_repo, 'download-policy': 'immediate', 'product-id': product['id'] }) Repository.synchronize({'id': repo['id']}) cls.exporting_cv = gen_string('alpha') content_view = make_content_view({ 'name': cls.exporting_cv, 'organization-id': cls.exporting_org['id'] }) ContentView.add_repository({ 'id': content_view['id'], 'organization-id': cls.exporting_org['id'], 'repository-id': repo['id'] }) ContentView.publish({u'id': content_view['id']}) content_view = ContentView.info({u'id': content_view['id']}) cls.exporting_cvv_id = content_view['versions'][0]['id']
def test_positive_chost_previous_env(self): """Check if the applicable errata are available from the content host's previous environment :id: 78110ba8-3942-46dd-8c14-bffa1dbd5195 :Setup: 1. Make sure multiple environments are present. 2. Content host's previous environments have additional errata. :Steps: Go to Content Hosts -> Select content host -> Errata Tab -> Select Previous environments. :expectedresults: The errata from previous environments are displayed. :CaseLevel: System """ with VirtualMachine(distro=DISTRO_RHEL7) as client: client.install_katello_ca() client.register_contenthost( self.session_org.label, self.activation_key.name, ) self.assertTrue(client.subscribed) client.enable_repo(REPOS['rhst7']['id']) client.install_katello_agent() client.run( 'yum install -y {0}'.format(FAKE_1_CUSTOM_PACKAGE)) last_env_id = max( lce.id for lce in entities.LifecycleEnvironment( organization=self.session_org).search() ) new_env = entities.LifecycleEnvironment( organization=self.session_org, prior=last_env_id, ).create() cvv = ContentView.info({ 'id': self.content_view.id})['versions'][-1] ContentView.version_promote({ 'id': cvv['id'], 'organization-id': self.session_org.id, 'to-lifecycle-environment-id': new_env.id, }) Host.update({ 'name': client.hostname, 'lifecycle-environment-id': new_env.id, 'organization-id': self.session_org.id, }) with Session(self): self.assertIsNotNone( self.contenthost.errata_search( client.hostname, CUSTOM_REPO_ERRATA_ID, environment_name=self.env.name, ) )
def test_add_docker_repo_to_composite_content_view(self): """@Test: Add one Docker-type repository to a composite content view @Assert: A repository is created with a Docker repository and the product is added to a content view which is then added to a composite content view. @Feature: Docker """ repo = _make_docker_repo( make_product({'organization-id': self.org_id})['id']) content_view = make_content_view({ 'composite': False, 'organization-id': self.org_id, }) result = ContentView.add_repository({ 'id': content_view['id'], 'repository-id': repo['id'], }) self.assertEqual(result.return_code, 0) content_view = ContentView.info({'id': content_view['id']}).stdout self.assertIn( repo['id'], [repo_['id'] for repo_ in content_view['docker-repositories']], ) result = ContentView.publish({'id': content_view['id']}) self.assertEqual(result.return_code, 0) content_view = ContentView.info({'id': content_view['id']}).stdout self.assertEqual(len(content_view['versions']), 1) comp_content_view = make_content_view({ 'composite': True, 'organization-id': self.org_id, }) result = ContentView.update({ 'id': comp_content_view['id'], 'component-ids': content_view['versions'][0]['id'], }) self.assertEqual(result.return_code, 0) comp_content_view = ContentView.info({ 'id': comp_content_view['id'], }).stdout self.assertIn( content_view['versions'][0]['id'], [component['id'] for component in comp_content_view['components']], )
def test_publish_multiple_docker_repo_composite_content_view(self): """@Test: Add Docker-type repository to content view and publish it multiple times. @Assert: One repository is created with a Docker image and the product is added to a content view which is then added to a composite content view which is then published multiple times. @Feature: Docker """ self._create_and_associate_repo_with_cv() self.assertEqual(len(self.content_view['versions']), 0) ContentView.publish({'id': self.content_view['id']}) self.content_view = ContentView.info({ 'id': self.content_view['id']}) self.assertEqual(len(self.content_view['versions']), 1) comp_content_view = make_content_view({ 'composite': True, 'organization-id': self.org_id, }) ContentView.update({ 'component-ids': self.content_view['versions'][0]['id'], 'id': comp_content_view['id'], }) comp_content_view = ContentView.info({ 'id': comp_content_view['id'], }) self.assertIn( self.content_view['versions'][0]['id'], [ component['id'] for component in comp_content_view['components'] ], ) publish_amount = randint(2, 5) for _ in range(publish_amount): ContentView.publish({'id': comp_content_view['id']}) comp_content_view = ContentView.info({ 'id': comp_content_view['id'], }) self.assertEqual(len(comp_content_view['versions']), publish_amount)
def setUpClass(cls): """Prepare some data to be used in tests""" super(HostCollectionTestCase, cls).setUpClass() cls.organization = make_org() cls.library = LifecycleEnvironment.info( {'organization-id': cls.organization['id'], 'name': ENVIRONMENT} ) cls.default_cv = ContentView.info( {'organization-id': cls.organization['id'], 'name': DEFAULT_CV} ) make_host_collection({'organization-id': cls.organization['id']})
def test_cv_preupgrade_scenario(self): """This is pre-upgrade scenario test to verify if we can create a content-view with various repositories. :id: a4ebbfa1-106a-4962-9c7c-082833879ae8 :steps: 1. Create custom yum, puppet and file repositories. 2. Create content-view. 3. Add yum, file repositories and puppet module to content view. 4. Publish content-view. :expectedresults: content-view created with various repositories. """ self.setupScenario() file_repo = self.make_file_repository_upload_contents() content_view = make_content_view( { 'name': self.cv_name, 'organization-id': self.org['id'], 'repository-ids': [self.yum_repo1['id'], file_repo['id']], } ) content_view = ContentView.info({'id': content_view['id']}) self.assertEqual( content_view['yum-repositories'][0]['name'], self.yum_repo1['name'], 'Repo was not associated to CV', ) ContentView.puppet_module_add( { 'content-view-id': content_view['id'], 'name': self.puppet_module['name'], 'author': self.puppet_module['author'], } ) content_view = ContentView.info({'id': content_view['id']}) self.assertGreater(len(content_view['puppet-modules']), 0) ContentView.publish({'id': content_view['id']}) cv = ContentView.info({'id': content_view['id']}) self.assertEqual(len(cv['versions']), 1)
def _make_fake_host_helper(module_org): """Make a new fake host""" library = LifecycleEnvironment.info({'organization-id': module_org.id, 'name': ENVIRONMENT}) default_cv = ContentView.info({'organization-id': module_org.id, 'name': DEFAULT_CV}) return make_fake_host( { 'content-view-id': default_cv['id'], 'lifecycle-environment-id': library['id'], 'name': gen_string('alpha', 15), 'organization-id': module_org.id, } )
def setUpClass(cls): """Prepare some data to be used in tests""" super(HostCollectionTestCase, cls).setUpClass() cls.organization = make_org() cls.library = LifecycleEnvironment.info({ u'organization-id': cls.organization['id'], u'name': ENVIRONMENT, }) cls.default_cv = ContentView.info({ u'organization-id': cls.organization['id'], u'name': DEFAULT_CV })
def test_cv_preupgrade_scenario(self): """This is pre-upgrade scenario test to verify if we can create a content-view with various repositories. :id: a4ebbfa1-106a-4962-9c7c-082833879ae8 :steps: 1. Create custom yum, puppet and file repositories. 2. Create content-view. 3. Add yum, file repositories and puppet module to content view. 4. Publish content-view. :expectedresults: content-view created with various repositories. """ self.setupScenario() file_repo = self.make_file_repository_upload_contents() content_view = make_content_view({ 'name': self.cv_name, 'organization-id': self.org['id'], 'repository-ids': [ self.yum_repo1['id'], file_repo['id']] }) content_view = ContentView.info({'id': content_view['id']}) self.assertEqual( content_view['yum-repositories'][0]['name'], self.yum_repo1['name'], 'Repo was not associated to CV', ) ContentView.puppet_module_add({ 'content-view-id': content_view['id'], 'name': self.puppet_module['name'], 'author': self.puppet_module['author'], }) content_view = ContentView.info({'id': content_view['id']}) self.assertGreater(len(content_view['puppet-modules']), 0) ContentView.publish({'id': content_view['id']}) cv = ContentView.info({'id': content_view['id']}) self.assertEqual(len(cv['versions']), 1)
def setUpClass(cls): """Create an organization, product and ostree repo.""" super(OstreeBranchTestCase, cls).setUpClass() cls.org = make_org() cls.product = make_product({u'organization-id': cls.org['id']}) # Create new custom ostree repo cls.ostree_repo = make_repository({ u'product-id': cls.product['id'], u'content-type': u'ostree', u'publish-via-http': u'false', u'url': FEDORA23_OSTREE_REPO, }) Repository.synchronize({'id': cls.ostree_repo['id']}) cls.cv = make_content_view({u'organization-id': cls.org['id']}) ContentView.publish({u'id': cls.cv['id']}) cls.cv = ContentView.info({u'id': cls.cv['id']})
def cv_publish_promote(cv, org, lce): """Publish and promote a new version into the given lifecycle environment. :param cv: content view :type cv: entities.ContentView :param org: organization :type org: entities.Organization :param lce: lifecycle environment :type lce: entities.LifecycleEnvironment """ ContentView.publish({'id': cv.id}) cvv = ContentView.info({'id': cv.id})['versions'][-1] ContentView.version_promote({ 'id': cvv['id'], 'organization-id': org.id, 'to-lifecycle-environment-id': lce.id, })
def test_publish_once_docker_repo_content_view(self): """@Test: Add Docker-type repository to content view and publish it once. @Assert: One repository is created with a Docker image and the product is added to a content view which is then published only once. @Feature: Docker """ self._create_and_associate_repo_with_cv() self.assertEqual(len(self.content_view['versions']), 0) ContentView.publish({'id': self.content_view['id']}) self.content_view = ContentView.info({ 'id': self.content_view['id'], }) self.assertEqual(len(self.content_view['versions']), 1)
def setUp(self): # noqa """Tests for Host Collections via Hammer CLI""" super(TestHostCollection, self).setUp() if TestHostCollection.org is None: TestHostCollection.org = make_org(cached=True) if TestHostCollection.new_lifecycle is None: TestHostCollection.new_lifecycle = make_lifecycle_environment( {u'organization-id': TestHostCollection.org['id']}, cached=True) if TestHostCollection.library is None: library_result = LifecycleEnvironment.info({ u'organization-id': TestHostCollection.org['id'], u'name': u'Library' }) TestHostCollection.library = library_result.stdout if TestHostCollection.default_cv is None: cv_result = ContentView.info({ u'organization-id': TestHostCollection.org['id'], u'name': u'Default Organization View' }) TestHostCollection.default_cv = cv_result.stdout if TestHostCollection.new_cv is None: TestHostCollection.new_cv = make_content_view( {u'organization-id': TestHostCollection.org['id']}) TestHostCollection.promoted_cv = None cv_id = TestHostCollection.new_cv['id'] ContentView.publish({u'id': cv_id}) result = ContentView.version_list({u'content-view-id': cv_id}) version_id = result.stdout[0]['id'] promotion = ContentView.version_promote({ u'id': version_id, u'to-lifecycle-environment-id': (TestHostCollection.new_lifecycle['id']), u'organization-id': TestHostCollection.org['id'] }) if promotion.stderr == []: TestHostCollection.promoted_cv = TestHostCollection.new_cv
def setUp(self): # noqa """Tests for Content Host via Hammer CLI""" super(TestContentHost, self).setUp() if TestContentHost.NEW_ORG is None: TestContentHost.NEW_ORG = make_org(cached=True) if TestContentHost.NEW_LIFECYCLE is None: TestContentHost.NEW_LIFECYCLE = make_lifecycle_environment( {u'organization-id': TestContentHost.NEW_ORG['id']}, cached=True) if TestContentHost.LIBRARY is None: library_result = LifecycleEnvironment.info({ u'organization-id': TestContentHost.NEW_ORG['id'], u'name': u'Library' }) TestContentHost.LIBRARY = library_result.stdout if TestContentHost.DEFAULT_CV is None: cv_result = ContentView.info({ u'organization-id': TestContentHost.NEW_ORG['id'], u'name': u'Default Organization View' }) TestContentHost.DEFAULT_CV = cv_result.stdout if TestContentHost.NEW_CV is None: TestContentHost.NEW_CV = make_content_view( {u'organization-id': TestContentHost.NEW_ORG['id']}) TestContentHost.PROMOTED_CV = None cv_id = TestContentHost.NEW_CV['id'] ContentView.publish({u'id': cv_id}) result = ContentView.version_list({u'content-view-id': cv_id}) version_id = result.stdout[0]['id'] promotion = ContentView.version_promote({ u'id': version_id, u'to-lifecycle-environment-id': TestContentHost.NEW_LIFECYCLE['id'], u'organization-id': TestContentHost.NEW_ORG['id'] }) if promotion.stderr == []: TestContentHost.PROMOTED_CV = TestContentHost.NEW_CV
def setUp(self): # noqa """Tests for Host Collections via Hammer CLI""" super(TestHostCollection, self).setUp() if TestHostCollection.org is None: TestHostCollection.org = make_org(cached=True) if TestHostCollection.new_lifecycle is None: TestHostCollection.new_lifecycle = make_lifecycle_environment( {u'organization-id': TestHostCollection.org['id']}, cached=True ) if TestHostCollection.library is None: result = LifecycleEnvironment.info({ u'organization-id': TestHostCollection.org['id'], u'name': u'Library', }) self.assertEqual(result.return_code, 0) TestHostCollection.library = result.stdout if TestHostCollection.default_cv is None: result = ContentView.info( {u'organization-id': TestHostCollection.org['id'], u'name': u'Default Organization View'} ) self.assertEqual(result.return_code, 0) TestHostCollection.default_cv = result.stdout if TestHostCollection.new_cv is None: TestHostCollection.new_cv = make_content_view( {u'organization-id': TestHostCollection.org['id']} ) TestHostCollection.promoted_cv = None cv_id = TestHostCollection.new_cv['id'] result = ContentView.publish({u'id': cv_id}) self.assertEqual(result.return_code, 0) result = ContentView.version_list({u'content-view-id': cv_id}) self.assertEqual(result.return_code, 0) version_id = result.stdout[0]['id'] result = ContentView.version_promote({ u'id': version_id, u'to-lifecycle-environment-id': ( TestHostCollection.new_lifecycle['id']), u'organization-id': TestHostCollection.org['id'] }) self.assertEqual(result.return_code, 0) TestHostCollection.promoted_cv = TestHostCollection.new_cv
def test_positive_usage_limit(self): """Test that Usage limit actually limits usage :id: 00ded856-e939-4140-ac84-91b6a8643623 :Steps: 1. Create Activation key 2. Update Usage Limit to a finite number 3. Register Content hosts to match the Usage Limit 4. Attempt to register an other Content host after reaching the Usage Limit :expectedresults: Content host Registration fails. Appropriate error shown :CaseLevel: System """ env = make_lifecycle_environment({u'organization-id': self.org['id']}) new_cv = make_content_view({u'organization-id': self.org['id']}) ContentView.publish({u'id': new_cv['id']}) cvv = ContentView.info({u'id': new_cv['id']})['versions'][0] ContentView.version_promote({ u'id': cvv['id'], u'to-lifecycle-environment-id': env['id'], }) new_ak = make_activation_key({ u'lifecycle-environment-id': env['id'], u'content-view': new_cv['name'], u'organization-id': self.org['id'], u'max-hosts': '1', }) with VirtualMachine(distro=DISTRO_RHEL6) as vm1: with VirtualMachine(distro=DISTRO_RHEL6) as vm2: vm1.install_katello_ca() result = vm1.register_contenthost( self.org['label'], new_ak['name']) self.assertTrue(vm1.subscribed) vm2.install_katello_ca() result = vm2.register_contenthost( self.org['label'], new_ak['name']) self.assertFalse(vm2.subscribed) self.assertEqual(result.return_code, 70) self.assertGreater(len(result.stderr), 0)
def local_ak(local_org, local_environment, local_content_view): """Promote a content view version and create an activation key with CLI Factory""" cvv = ContentView.info({'id': local_content_view['id']})['versions'][0] ContentView.version_promote({ 'id': cvv['id'], 'to-lifecycle-environment-id': local_environment['id'] }) return make_activation_key({ 'lifecycle-environment-id': local_environment['id'], 'content-view': local_content_view['name'], 'organization-id': local_org['id'], 'auto-attach': False, })
def setUp(self): """Tests for Host Collections via Hammer CLI""" super(HostCollectionTestCase, self).setUp() if HostCollectionTestCase.org is None: HostCollectionTestCase.org = make_org(cached=True) if HostCollectionTestCase.new_lifecycle is None: HostCollectionTestCase.new_lifecycle = make_lifecycle_environment( {u'organization-id': HostCollectionTestCase.org['id']}, cached=True) if HostCollectionTestCase.library is None: HostCollectionTestCase.library = LifecycleEnvironment.info({ u'organization-id': HostCollectionTestCase.org['id'], u'name': ENVIRONMENT, }) if HostCollectionTestCase.default_cv is None: HostCollectionTestCase.default_cv = ContentView.info({ u'organization-id': HostCollectionTestCase.org['id'], u'name': DEFAULT_CV }) if HostCollectionTestCase.new_cv is None: HostCollectionTestCase.new_cv = make_content_view( {u'organization-id': HostCollectionTestCase.org['id']}) HostCollectionTestCase.promoted_cv = None cv_id = HostCollectionTestCase.new_cv['id'] ContentView.publish({u'id': cv_id}) result = ContentView.version_list({u'content-view-id': cv_id}) version_id = result[0]['id'] ContentView.version_promote({ u'id': version_id, u'organization-id': HostCollectionTestCase.org['id'], u'to-lifecycle-environment-id': (HostCollectionTestCase.new_lifecycle['id']), }) HostCollectionTestCase.promoted_cv = HostCollectionTestCase.new_cv
def test_positive_usage_limit(self): """Test that Usage limit actually limits usage @Feature: Activation key - Usage limit @Steps: 1. Create Activation key 2. Update Usage Limit to a finite number 3. Register Content hosts to match the Usage Limit 4. Attempt to register an other Content host after reaching the Usage Limit @Assert: Content host Registration fails. Appropriate error shown """ env = make_lifecycle_environment({u'organization-id': self.org['id']}) new_cv = make_content_view({u'organization-id': self.org['id']}) ContentView.publish({u'id': new_cv['id']}) cvv = ContentView.info({u'id': new_cv['id']})['versions'][0] ContentView.version_promote({ u'id': cvv['id'], u'to-lifecycle-environment-id': env['id'], }) new_ak = make_activation_key({ u'lifecycle-environment-id': env['id'], u'content-view': new_cv['name'], u'organization-id': self.org['id'], u'max-content-hosts': '1', }) with VirtualMachine(distro='rhel65') as vm1: with VirtualMachine(distro='rhel65') as vm2: vm1.install_katello_ca() result = vm1.register_contenthost( new_ak['name'], self.org['label']) self.assertEqual(result.return_code, 0) vm2.install_katello_ca() result = vm2.register_contenthost( new_ak['name'], self.org['label']) self.assertEqual(result.return_code, 255) self.assertGreater(len(result.stderr), 0)
def test_positive_sync_publish_promote_cv(self): """Synchronize repository with DRPMs, add repository to content view, publish and promote content view to lifecycle environment @id: a01cb12b-d388-4902-8532-714f4e28ec56 @Assert: drpms can be listed in content view in proper lifecycle environment """ lce = make_lifecycle_environment({'organization-id': self.org['id']}) repo = make_repository({ 'product-id': self.product['id'], 'url': FAKE_YUM_DRPM_REPO, }) Repository.synchronize({'id': repo['id']}) cv = make_content_view({'organization-id': self.org['id']}) ContentView.add_repository({ 'id': cv['id'], 'repository-id': repo['id'], }) ContentView.publish({'id': cv['id']}) content_view = ContentView.info({'id': cv['id']}) cvv = content_view['versions'][0] ContentView.version_promote({ 'id': cvv['id'], 'to-lifecycle-environment-id': lce['id'], }) result = ssh.command( 'ls /var/lib/pulp/published/yum/https/repos/{}/{}/{}/custom/{}/{}' '/drpms/ | grep .drpm'.format( self.org['label'], lce['label'], cv['label'], self.product['label'], repo['label'], )) self.assertEqual(result.return_code, 0) self.assertGreaterEqual(len(result.stdout), 1)
def test_positive_create_with_multiple_entities_and_delete(self): """Check if hostgroup with multiple options can be created and deleted :id: a3ef4f0e-971d-4307-8d0a-35103dff6586 :expectedresults: Hostgroup should be created, has all defined entities assigned and deleted :BZ: 1395254, 1313056 :CaseLevel: Integration :CaseImportance: Critical """ # Common entities name = valid_hostgroups_list()[0] loc = make_location() org = make_org() orgs = [org, self.org] env = make_environment({ 'location-ids': loc['id'], 'organization-ids': org['id'] }) lce = make_lifecycle_environment({'organization-id': org['id']}) # Content View should be promoted to be used with LC Env cv = make_content_view({'organization-id': org['id']}) ContentView.publish({'id': cv['id']}) cv = ContentView.info({'id': cv['id']}) ContentView.version_promote({ 'id': cv['versions'][0]['id'], 'to-lifecycle-environment-id': lce['id'] }) # Network domain = make_domain({ 'location-ids': loc['id'], 'organization-ids': org['id'] }) subnet = make_subnet({ 'domain-ids': domain['id'], 'organization-ids': org['id'] }) # Operating System arch = make_architecture() ptable = make_partition_table({ 'location-ids': loc['id'], 'organization-ids': org['id'] }) os = make_os({ 'architecture-ids': arch['id'], 'partition-table-ids': ptable['id'] }) os_full_name = "{0} {1}.{2}".format(os['name'], os['major-version'], os['minor-version']) media = make_medium({ 'operatingsystem-ids': os['id'], 'location-ids': loc['id'], 'organization-ids': org['id'], }) # Note: in the current hammer version there is no content source name # option make_hostgroup_params = { 'name': name, 'organization-ids': [org['id'] for org in orgs], 'locations': loc['name'], 'environment': env['name'], 'lifecycle-environment': lce['name'], 'puppet-proxy': self.content_source['name'], 'puppet-ca-proxy': self.content_source['name'], 'content-source-id': self.content_source['id'], 'content-view': cv['name'], 'domain': domain['name'], 'subnet': subnet['name'], 'architecture': arch['name'], 'partition-table': ptable['name'], 'medium': media['name'], 'operatingsystem': os_full_name, 'puppet-classes': self.puppet_classes[0]['name'], 'query-organization': org['name'], } hostgroup = make_hostgroup(make_hostgroup_params) self.assertEqual(hostgroup['name'], name) self.assertEqual(set(org['name'] for org in orgs), set(hostgroup['organizations'])) self.assertIn(loc['name'], hostgroup['locations']) self.assertEqual(env['name'], hostgroup['puppet-environment']) self.assertEqual(self.content_source['name'], hostgroup['puppet-master-proxy']) self.assertEqual(self.content_source['name'], hostgroup['puppet-ca-proxy']) self.assertEqual(domain['name'], hostgroup['network']['domain']) self.assertEqual(subnet['name'], hostgroup['network']['subnet-ipv4']) self.assertEqual(arch['name'], hostgroup['operating-system']['architecture']) self.assertEqual(ptable['name'], hostgroup['operating-system']['partition-table']) self.assertEqual(media['name'], hostgroup['operating-system']['medium']) self.assertEqual(os_full_name, hostgroup['operating-system']['operating-system']) self.assertEqual(cv['name'], hostgroup['content-view']['name']) self.assertEqual(lce['name'], hostgroup['lifecycle-environment']['name']) self.assertEqual(self.content_source['name'], hostgroup['content-source']['name']) self.assertIn(self.puppet_classes[0]['name'], hostgroup['puppetclasses']) # delete hostgroup HostGroup.delete({'id': hostgroup['id']}) with self.assertRaises(CLIReturnCodeError): HostGroup.info({'id': hostgroup['id']})
def test_cv_postupgrade_scenario(self): """This is post-upgrade scenario test to verify if we can update content-view created in pre-upgrade scenario with various repositories. :id: a4ebbfa1-106a-4962-9c7c-082833879ae8 :steps: 1. Remove yum repository which was added to content-view before upgrade. 2. Create new yum repository and add it to content-view. 3. Remove puppet module which was added to content-view before upgrade. 4. Add another puppet module to content-view 5. Publish content-view :expectedresults: content-view updated with various repositories. """ product_id = Repository.info({ 'name': self.yum_repo1_name, 'organization': self.org_name, 'product': self.product_name })['product']['id'] ContentView.remove_repository({ 'organization': self.org_name, 'name': self.cv_name, 'repository': self.yum_repo1_name }) content_view = ContentView.info({ 'name': self.cv_name, 'organization': self.org_name }) self.assertNotIn(self.yum_repo1_name, content_view['yum-repositories']) yum_repo2 = make_repository({ 'name': self.yum_repo2_name, 'organization': self.org_name, 'content-type': 'yum', 'product-id': product_id, 'url': FAKE_2_YUM_REPO }) Repository.synchronize({ 'id': yum_repo2['id'], 'organization': self.org_name }) ContentView.add_repository({ 'name': self.cv_name, 'organization': self.org_name, 'product': self.product_name, 'repository-id': yum_repo2['id'] }) content_view = ContentView.info({ 'name': self.cv_name, 'organization': self.org_name }) self.assertEqual( content_view['yum-repositories'][0]['name'], self.yum_repo2_name, 'Repo was not associated to CV', ) ContentView.puppet_module_remove({ 'organization': self.org_name, 'content-view': self.cv_name, 'name': self.puppet_module_name, 'author': self.puppet_module_author, }) content_view = ContentView.info({ 'name': self.cv_name, 'organization': self.org_name }) self.assertEqual(len(content_view['puppet-modules']), 0) module = {'name': 'versioned', 'version': '2.2.2'} puppet_module = PuppetModule.list( {'search': 'name={name} and version={version}'.format(**module)})[0] ContentView.puppet_module_add({ 'organization': self.org_name, 'content-view': self.cv_name, 'name': puppet_module['name'], 'author': puppet_module['author'], }) content_view = ContentView.info({'id': content_view['id']}) self.assertGreater(len(content_view['puppet-modules']), 0) ContentView.publish({ 'name': self.cv_name, 'organization': self.org_name }) content_view = ContentView.info({ 'name': self.cv_name, 'organization': self.org_name }) self.assertEqual(len(content_view['versions']), 2)
def setUpClass(cls): """Setup must ensure there is an Org with Golden Ticket enabled. Option 1) SQL:: UPDATE cp_owner SET content_access_mode = 'org_environment', content_access_mode_list='entitlement,org_environment' WHERE account='{org.label}'; Option 2) manifest:: Change manifest file as it looks like: Consumer: Name: ExampleCorp UUID: c319a1d8-4b30-44cd-b2cf-2ccba4b9a8db Content Access Mode: org_environment Type: satellite :steps: 1. Create a new organization. 2. Use either option 1 or option 2 (described above) to activate the Golden Ticket. 3. Create a Product and CV for org. 4. Add a repository pointing to a real repo which requires a RedHat subscription to access. 5. Create Content Host and assign that gated repos to it. 6. Sync the gated repository. """ super(ContentAccessTestCase, cls).setUpClass() # Create Organization cls.org = make_org() # upload organization manifest with org environment access enabled cls.manifest = manifests.clone(org_environment_access=True) manifests.upload_manifest_locked(cls.org['id'], cls.manifest, interface=manifests.INTERFACE_CLI) # Create repositories cls.repos = [ # Red Hat Enterprise Linux 7 { 'product': PRDS['rhel'], 'repository-set': REPOSET['rhel7'], 'repository': REPOS['rhel7']['name'], 'repository-id': REPOS['rhel7']['id'], 'releasever': REPOS['rhel7']['releasever'], 'arch': REPOS['rhel7']['arch'], 'cdn': True, }, # Red Hat Satellite Tools { 'product': PRDS['rhel'], 'repository-set': REPOSET['rhst7'], 'repository': REPOS['rhst7']['name'], 'repository-id': REPOS['rhst7']['id'], 'url': settings.sattools_repo['rhel7'], 'cdn': bool(settings.cdn or not settings.sattools_repo['rhel7']), }, ] cls.custom_product, cls.repos_info = setup_cdn_and_custom_repositories( cls.org['id'], cls.repos) # Create a content view content_view = make_content_view({u'organization-id': cls.org['id']}) # Add repositories to content view for repo_info in cls.repos_info: ContentView.add_repository({ u'id': content_view['id'], u'organization-id': cls.org['id'], u'repository-id': repo_info['id'], }) # Publish the content view ContentView.publish({u'id': content_view['id']}) cls.content_view = ContentView.info({u'id': content_view['id']})
def test_positive_show_count_on_chost_details_page(self): """Errata count on Content host Details page @id: 388229da-2b0b-41aa-a457-9b5ecbf3df4b @Setup: 1. Errata synced on satellite server. 2. Some content hosts are present. @Steps: 1. Go to Hosts -> Content Hosts -> Select Content Host -> Details page. @Assert: 1. The errata section should be displayed with Security, Bugfix, Enhancement types. 2. The number should link to the errata details page, filtered by type. @CaseLevel: System """ org = entities.Organization().create() env = entities.LifecycleEnvironment(organization=org).create() content_view = entities.ContentView(organization=org).create() activation_key = entities.ActivationKey( environment=env, organization=org, ).create() setup_org_for_a_rh_repo({ 'product': PRDS['rhel'], 'repository-set': REPOSET['rhst6'], 'repository': REPOS['rhst6']['name'], 'organization-id': org.id, 'content-view-id': content_view.id, 'lifecycle-environment-id': env.id, 'activationkey-id': activation_key.id, }) setup_org_for_a_custom_repo({ 'url': CUSTOM_REPO_URL, 'organization-id': org.id, 'content-view-id': content_view.id, 'lifecycle-environment-id': env.id, 'activationkey-id': activation_key.id, }) RepositorySet.enable({ 'basearch': DEFAULT_ARCHITECTURE, 'name': REPOSET['rhva6'], 'organization-id': org.id, 'product': PRDS['rhel'], 'releasever': DEFAULT_RELEASE_VERSION, }) rhel_repo = Repository.info({ 'name': REPOS['rhva6']['name'], 'organization-id': org.id, 'product': PRDS['rhel'], }) Repository.synchronize({ 'name': REPOS['rhva6']['name'], 'organization-id': org.id, 'product': PRDS['rhel'], }) ContentView.add_repository({ 'id': content_view.id, 'organization-id': org.id, 'repository-id': rhel_repo['id'], }) ContentView.publish({'id': content_view.id}) cvv = ContentView.info({'id': content_view.id})['versions'][-1] ContentView.version_promote({ 'id': cvv['id'], 'organization-id': org.id, 'to-lifecycle-environment-id': env.id, }) with VirtualMachine(distro='rhel67') as client: client.install_katello_ca() result = client.register_contenthost( org.label, activation_key.name, ) self.assertEqual(result.return_code, 0) client.enable_repo(REPOS['rhst6']['id']) client.enable_repo(REPOS['rhva6']['id']) client.install_katello_agent() with Session(self.browser) as session: session.nav.go_to_select_org(org.name) result = self.contenthost.fetch_errata_counts( client.hostname, details_page=True) for errata in ('security', 'bug_fix', 'enhancement'): self.assertEqual(result[errata]['value'], 0) self.assertEqual(result[errata]['color'], 'black') client.run('yum install -y {0}'.format(FAKE_1_CUSTOM_PACKAGE)) result = self.contenthost.fetch_errata_counts( client.hostname, details_page=True) self.assertEqual(result['security']['value'], 1) self.assertEqual(result['security']['color'], 'red') client.run('yum install -y {0}'.format(REAL_0_RH_PACKAGE)) result = self.contenthost.fetch_errata_counts( client.hostname, details_page=True) for errata in ('bug_fix', 'enhancement'): self.assertEqual(result[errata]['value'], 1) self.assertEqual(result[errata]['color'], 'yellow')
def test_positive_create_with_synced_content(self): """Check if hostgroup with synced kickstart repository can be created :id: 7c51ac72-359c-488a-8658-88b5a94d7e7a :customerscenario: true :expectedresults: Hostgroup should be created and has proper installation content id present :BZ: 1415707 :CaseLevel: Integration """ # Check whether path to kickstart media is set if settings.rhel6_os is None: raise ValueError( 'Installation media path is not set in properties file') # Common entities org = make_org() lce = make_lifecycle_environment({'organization-id': org['id']}) product = make_product({'organization-id': org['id']}) repo = make_repository({ u'url': settings.rhel6_os, u'product-id': product['id'], u'content-type': u'yum', }) Repository.synchronize({'id': repo['id']}) cv = make_content_view({ 'organization-id': org['id'], 'repository-ids': [repo['id']], }) ContentView.publish({'id': cv['id']}) cv = ContentView.info({'id': cv['id']}) cvv = cv['versions'][0] ContentView.version_promote({ 'id': cvv['id'], 'to-lifecycle-environment-id': lce['id'], }) # Get the Partition table ID ptable = PartitionTable.info({'name': DEFAULT_PTABLE}) # Get the arch ID arch = Architecture.list( {'search': 'name={0}'.format(DEFAULT_ARCHITECTURE)})[0] # Get the OS ID os = OperatingSys.list({ 'search': 'name="RedHat" AND major="{0}" OR major="{1}"'.format( RHEL_6_MAJOR_VERSION, RHEL_7_MAJOR_VERSION) })[0] # Update the OS with found arch and ptable OperatingSys.update({ 'id': os['id'], 'architectures': arch['name'], 'partition-tables': ptable['name'], }) proxy = Proxy.list({ 'search': 'url = https://{0}:9090'.format(settings.server.hostname) })[0] # Search for proper installation repository id synced_repo = Repository.list({ 'content-view-version-id': cvv['id'], 'organization-id': org['id'], 'environment-id': lce['id'], })[0] hostgroup = make_hostgroup({ 'lifecycle-environment-id': lce['id'], 'puppet-proxy-id': proxy['id'], 'puppet-ca-proxy-id': proxy['id'], 'content-source-id': proxy['id'], 'content-view-id': cv['id'], 'organization-ids': org['id'], 'architecture-id': arch['id'], 'partition-table-id': ptable['id'], 'operatingsystem-id': os['id'], 'kickstart-repository-id': synced_repo['id'], }) hg = HostGroup.info({'id': hostgroup['id']}, output_format='json') self.assertEqual(hg['kickstart-repository']['id'], synced_repo['id'])
def test_positive_create_with_multiple_entities_ids(self): """Check if hostgroup with multiple options ids can be created :id: 6277613b-0ece-4dee-b9d8-504f8299ac38 :expectedresults: Hostgroup should be created and has all defined entities assigned :BZ: 1395254, 1313056 :CaseLevel: Integration """ # Common entities loc = make_location() org = make_org() env = make_environment({ 'location-ids': loc['id'], 'organization-ids': org['id'], }) lce = make_lifecycle_environment({'organization-id': org['id']}) proxy = Proxy.list({ 'search': 'url = https://{0}:9090'.format(settings.server.hostname) })[0] # Content View should be promoted to be used with LC Env cv = make_content_view({'organization-id': org['id']}) ContentView.publish({'id': cv['id']}) cv = ContentView.info({'id': cv['id']}) ContentView.version_promote({ 'id': cv['versions'][0]['id'], 'to-lifecycle-environment-id': lce['id'], }) # Network domain = make_domain({ 'location-ids': loc['id'], 'organization-ids': org['id'], }) subnet = make_subnet({ 'domain-ids': domain['id'], 'organization-ids': org['id'], }) # Operating System arch = make_architecture() ptable = make_partition_table({ 'location-ids': loc['id'], 'organization-ids': org['id'], }) os = make_os({ 'architecture-ids': arch['id'], 'partition-table-ids': ptable['id'], }) media = make_medium({ 'operatingsystem-ids': os['id'], 'location-ids': loc['id'], 'organization-ids': org['id'], }) make_hostgroup_params = { 'location-ids': loc['id'], 'environment-id': env['id'], 'lifecycle-environment-id': lce['id'], 'puppet-proxy-id': proxy['id'], 'puppet-ca-proxy-id': proxy['id'], 'content-source-id': proxy['id'], 'content-view-id': cv['id'], 'domain-id': domain['id'], 'subnet-id': subnet['id'], 'organization-ids': org['id'], 'architecture-id': arch['id'], 'partition-table-id': ptable['id'], 'medium-id': media['id'], 'operatingsystem-id': os['id'], } hostgroup = make_hostgroup(make_hostgroup_params) self.assertEqual(cv['id'], hostgroup['content-view']['id']) self.assertEqual(lce['id'], hostgroup['lifecycle-environment']['id']) self.assertEqual(proxy['id'], hostgroup['content-source']['id']) # get the json output format hostgroup = HostGroup.info({'id': hostgroup['id']}, output_format='json') self.assertIn(org['id'], hostgroup['organizations'][0]['id']) self.assertIn(loc['id'], hostgroup['locations'][0]['id']) self.assertEqual(env['id'], hostgroup['puppet-environment']['id']) self.assertEqual(proxy['id'], hostgroup['puppet-master-proxy']['id']) self.assertEqual(proxy['id'], hostgroup['puppet-ca-proxy']['id']) self.assertEqual(domain['id'], hostgroup['network']['domain']['id']) self.assertEqual(subnet['id'], hostgroup['network']['subnet-ipv4']['id']) self.assertEqual(arch['id'], hostgroup['operating-system']['architecture']['id']) self.assertEqual( ptable['id'], hostgroup['operating-system']['partition-table']['id']) self.assertEqual(media['id'], hostgroup['operating-system']['medium']['id']) self.assertEqual( os['id'], hostgroup['operating-system']['operating-system']['id'])
def test_positive_create_with_multiple_entities_name(self): """Check if hostgroup with multiple options name can be created :id: a3ef4f0e-971d-4307-8d0a-35103dff6586 :expectedresults: Hostgroup should be created and has all defined entities assigned :BZ: 1395254, 1313056 :CaseLevel: Integration """ # Common entities loc = make_location() org = make_org() env = make_environment({ 'location-ids': loc['id'], 'organization-ids': org['id'], }) lce = make_lifecycle_environment({'organization-id': org['id']}) proxy = Proxy.list({ 'search': 'url = https://{0}:9090'.format(settings.server.hostname) })[0] # Content View should be promoted to be used with LC Env cv = make_content_view({'organization-id': org['id']}) ContentView.publish({'id': cv['id']}) cv = ContentView.info({'id': cv['id']}) ContentView.version_promote({ 'id': cv['versions'][0]['id'], 'to-lifecycle-environment-id': lce['id'], }) # Network domain = make_domain({ 'location-ids': loc['id'], 'organization-ids': org['id'], }) subnet = make_subnet({ 'domain-ids': domain['id'], 'organization-ids': org['id'], }) # Operating System arch = make_architecture() ptable = make_partition_table({ 'location-ids': loc['id'], 'organization-ids': org['id'], }) os = make_os({ 'architecture-ids': arch['id'], 'partition-table-ids': ptable['id'], }) os_full_name = "{0} {1}.{2}".format(os['name'], os['major-version'], os['minor-version']) media = make_medium({ 'operatingsystem-ids': os['id'], 'location-ids': loc['id'], 'organization-ids': org['id'], }) # Note: in the current hammer version there is no content source name # option make_hostgroup_params = { 'organizations': org['name'], 'locations': loc['name'], 'environment': env['name'], 'lifecycle-environment': lce['name'], 'puppet-proxy': proxy['name'], 'puppet-ca-proxy': proxy['name'], 'content-source-id': proxy['id'], 'content-view': cv['name'], 'domain': domain['name'], 'subnet': subnet['name'], 'architecture': arch['name'], 'partition-table': ptable['name'], 'medium': media['name'], 'operatingsystem': os_full_name, 'query-organization': org['name'] } hostgroup = make_hostgroup(make_hostgroup_params) self.assertIn(org['name'], hostgroup['organizations']) self.assertIn(loc['name'], hostgroup['locations']) self.assertEqual(env['name'], hostgroup['puppet-environment']) self.assertEqual(proxy['name'], hostgroup['puppet-master-proxy']) self.assertEqual(proxy['name'], hostgroup['puppet-ca-proxy']) self.assertEqual(domain['name'], hostgroup['network']['domain']) self.assertEqual(subnet['name'], hostgroup['network']['subnet-ipv4']) self.assertEqual(arch['name'], hostgroup['operating-system']['architecture']) self.assertEqual(ptable['name'], hostgroup['operating-system']['partition-table']) self.assertEqual(media['name'], hostgroup['operating-system']['medium']) self.assertEqual(os_full_name, hostgroup['operating-system']['operating-system']) self.assertEqual(cv['name'], hostgroup['content-view']['name']) self.assertEqual(lce['name'], hostgroup['lifecycle-environment']['name']) self.assertEqual(proxy['name'], hostgroup['content-source']['name'])
def test_positive_create_with_multiple_entities(self): """Check if hostgroup with multiple options can be created :id: a3ef4f0e-971d-4307-8d0a-35103dff6586 :expectedresults: Hostgroup should be created and has all defined entities assigned :CaseLevel: Integration """ # Common entities loc = make_location() org = make_org() env = make_environment({ 'location-ids': loc['id'], 'organization-ids': org['id'], }) lce = make_lifecycle_environment({'organization-id': org['id']}) puppet_proxy = Proxy.list({ 'search': 'url = https://{0}:9090'.format(settings.server.hostname) })[0] # Content View should be promoted to be used with LC Env cv = make_content_view({'organization-id': org['id']}) ContentView.publish({'id': cv['id']}) cv = ContentView.info({'id': cv['id']}) ContentView.version_promote({ 'id': cv['versions'][0]['id'], 'to-lifecycle-environment-id': lce['id'], }) # Network domain = make_domain({ 'location-ids': loc['id'], 'organization-ids': org['id'], }) subnet = make_subnet({ 'domain-ids': domain['id'], 'organization-ids': org['id'], }) # Operating System arch = make_architecture() ptable = make_partition_table({ 'location-ids': loc['id'], 'organization-ids': org['id'], }) os = make_os({ 'architecture-ids': arch['id'], 'partition-table-ids': ptable['id'], }) media = make_medium({ 'operatingsystem-ids': os['id'], 'location-ids': loc['id'], 'organization-ids': org['id'], }) make_hostgroup_params = { 'location-ids': loc['id'], 'environment-id': env['id'], 'lifecycle-environment': lce['name'], 'puppet-proxy-id': puppet_proxy['id'], 'puppet-ca-proxy-id': puppet_proxy['id'], 'content-view-id': cv['id'], 'domain-id': domain['id'], 'subnet-id': subnet['id'], 'organization-ids': org['id'], 'architecture-id': arch['id'], 'partition-table-id': ptable['id'], 'medium-id': media['id'], 'operatingsystem-id': os['id'], } # If bug is open provide LCE id as parameter # because LCE name cause errors if bz_bug_is_open(1395254): make_hostgroup_params.pop('lifecycle-environment') make_hostgroup_params['lifecycle-environment-id'] = lce['id'] hostgroup = make_hostgroup(make_hostgroup_params) self.assertIn(org['name'], hostgroup['organizations']) self.assertIn(loc['name'], hostgroup['locations']) self.assertEqual(env['name'], hostgroup['environment']) self.assertEqual(puppet_proxy['id'], hostgroup['puppet-master-proxy-id']) self.assertEqual(puppet_proxy['id'], hostgroup['puppet-ca-proxy-id']) self.assertEqual(domain['name'], hostgroup['domain']) self.assertEqual(subnet['name'], hostgroup['subnet']) self.assertEqual(arch['name'], hostgroup['architecture']) self.assertEqual(ptable['name'], hostgroup['partition-table']) self.assertEqual(media['name'], hostgroup['medium']) self.assertEqual( "{0} {1}.{2}".format(os['name'], os['major-version'], os['minor-version']), hostgroup['operating-system']) if not bz_bug_is_open('1313056'): self.assertEqual(cv['name'], hostgroup['content-view']) self.assertEqual(lce['name'], hostgroup['lifecycle-environment'])
def test_positive_create_with_multiple_entities_and_delete( module_puppet_org, puppet_content_source, puppet_classes, session_puppet_enabled_sat): """Check if hostgroup with multiple options can be created and deleted :id: a3ef4f0e-971d-4307-8d0a-35103dff6586 :expectedresults: Hostgroup should be created, has all defined entities assigned and deleted :BZ: 1395254, 1313056 :CaseLevel: Integration :CaseImportance: Critical """ with session_puppet_enabled_sat: # Common entities name = valid_hostgroups_list()[0] loc = make_location() org_2 = entities.Organization().create() orgs = [module_puppet_org, org_2] env = make_environment({ 'location-ids': loc['id'], 'organization-ids': org_2.id }) lce = make_lifecycle_environment({'organization-id': org_2.id}) # Content View should be promoted to be used with LC Env cv = make_content_view({'organization-id': org_2.id}) ContentView.publish({'id': cv['id']}) cv = ContentView.info({'id': cv['id']}) ContentView.version_promote({ 'id': cv['versions'][0]['id'], 'to-lifecycle-environment-id': lce['id'] }) # Network domain = make_domain({ 'location-ids': loc['id'], 'organization-ids': org_2.id }) subnet = make_subnet({ 'domain-ids': domain['id'], 'organization-ids': org_2.id }) # Operating System arch = make_architecture() ptable = make_partition_table({ 'location-ids': loc['id'], 'organization-ids': org_2.id }) os = make_os({ 'architecture-ids': arch['id'], 'partition-table-ids': ptable['id'] }) os_full_name = "{} {}.{}".format(os['name'], os['major-version'], os['minor-version']) media = make_medium({ 'operatingsystem-ids': os['id'], 'location-ids': loc['id'], 'organization-ids': org_2.id, }) # Note: in the current hammer version there is no content source name # option make_hostgroup_params = { 'name': name, 'organization-ids': [org.id for org in orgs], 'locations': loc['name'], 'puppet-environment': env['name'], 'lifecycle-environment-id': lce['id'], 'puppet-proxy': puppet_content_source['name'], 'puppet-ca-proxy': puppet_content_source['name'], 'content-source-id': puppet_content_source['id'], 'content-view': cv['name'], 'domain': domain['name'], 'subnet': subnet['name'], 'architecture': arch['name'], 'partition-table': ptable['name'], 'medium': media['name'], 'operatingsystem': os_full_name, 'puppet-classes': puppet_classes[0]['name'], 'query-organization': org_2.name, } hostgroup = make_hostgroup(make_hostgroup_params) assert hostgroup['name'] == name assert {org.name for org in orgs} == set(hostgroup['organizations']) assert loc['name'] in hostgroup['locations'] assert env['name'] == hostgroup['puppet-environment'] assert puppet_content_source['name'] == hostgroup[ 'puppet-master-proxy'] assert puppet_content_source['name'] == hostgroup['puppet-ca-proxy'] assert domain['name'] == hostgroup['network']['domain'] assert subnet['name'] == hostgroup['network']['subnet-ipv4'] assert arch['name'] == hostgroup['operating-system']['architecture'] assert ptable['name'] == hostgroup['operating-system'][ 'partition-table'] assert media['name'] == hostgroup['operating-system']['medium'] assert os_full_name == hostgroup['operating-system'][ 'operating-system'] assert cv['name'] == hostgroup['content-view']['name'] assert lce['name'] == hostgroup['lifecycle-environment']['name'] assert puppet_content_source['name'] == hostgroup['content-source'][ 'name'] assert puppet_classes[0]['name'] in hostgroup['puppetclasses'] # delete hostgroup HostGroup.delete({'id': hostgroup['id']}) with pytest.raises(CLIReturnCodeError): HostGroup.info({'id': hostgroup['id']})