def test_positive_add_product_with_repos(self): """Create gpg key with valid name and valid gpg key via file import then associate it with custom product that has more than one repository :id: b05c5223-44d5-4a48-9d99-18ca351c84a5 :expectedresults: gpg key is associated with product as well as with the repositories :CaseLevel: Integration """ product = make_product({'organization-id': self.org['id']}) repos = [ make_repository({'product-id': product['id']}) for _ in range(gen_integer(2, 5)) ] gpg_key = make_gpg_key({'organization-id': self.org['id']}) Product.update({ 'gpg-key': gpg_key['name'], 'id': product['id'], 'organization-id': self.org['id'], }) product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'], }) self.assertEqual(product['gpg']['gpg-key-id'], gpg_key['id']) for repo in repos: repo = Repository.info({'id': repo['id']}) self.assertEqual(repo['gpg-key']['id'], gpg_key['id'])
def test_positive_update_gpg_key(self): """Update product's gpg keys @Feature: Product @Assert: Product gpg key is updated """ first_gpg_key = make_gpg_key({u'organization-id': self.org['id']}) second_gpg_key = make_gpg_key({u'organization-id': self.org['id']}) product = make_product({ u'gpg-key-id': first_gpg_key['id'], u'organization-id': self.org['id'], }) # Update the Descriptions Product.update({ u'gpg-key-id': second_gpg_key['id'], u'id': product['id'], }) # Fetch it product = Product.info({ u'id': product['id'], u'organization-id': self.org['id'], }) self.assertEqual(product['gpg']['gpg-key-id'], second_gpg_key['id']) self.assertNotEqual(product['gpg']['gpg-key-id'], first_gpg_key['id'])
def test_positive_update_gpg_key(self): """Update product's gpg keys :id: e7febd14-ac8b-424e-9ddf-bf0f63ebe430 :expectedresults: Product gpg key is updated :CaseImportance: Critical """ first_gpg_key = make_gpg_key({u'organization-id': self.org['id']}) second_gpg_key = make_gpg_key({u'organization-id': self.org['id']}) product = make_product({ u'gpg-key-id': first_gpg_key['id'], u'organization-id': self.org['id'], }) # Update the Descriptions Product.update({ u'gpg-key-id': second_gpg_key['id'], u'id': product['id'], }) # Fetch it product = Product.info({ u'id': product['id'], u'organization-id': self.org['id'], }) self.assertEqual(product['gpg']['gpg-key-id'], second_gpg_key['id']) self.assertNotEqual(product['gpg']['gpg-key-id'], first_gpg_key['id'])
def test_positive_update_sync_plan(self): """Update product's sync plan @Feature: Product @Assert: Product sync plan is updated """ first_sync_plan = make_sync_plan({u'organization-id': self.org['id']}) second_sync_plan = make_sync_plan({u'organization-id': self.org['id']}) product = make_product({ u'organization-id': self.org['id'], u'sync-plan-id': first_sync_plan['id'], }) # Update the Descriptions Product.update({ u'id': product['id'], u'sync-plan-id': second_sync_plan['id'], }) # Fetch it product = Product.info({ u'id': product['id'], u'organization-id': self.org['id'], }) self.assertEqual(product['sync-plan-id'], second_sync_plan['id']) self.assertNotEqual(product['sync-plan-id'], first_sync_plan['id'])
def test_positive_add_product_with_repos(self): """@test: Create gpg key with valid name and valid gpg key via file import then associate it with custom product that has more than one repository @feature: GPG Keys @assert: gpg key is associated with product as well as with the repositories """ product = make_product({'organization-id': self.org['id']}) repos = [ make_repository({'product-id': product['id']}) for _ in range(gen_integer(2, 5)) ] gpg_key = make_gpg_key({'organization-id': self.org['id']}) Product.update({ 'gpg-key': gpg_key['name'], 'id': product['id'], 'organization-id': self.org['id'], }) product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'], }) self.assertEqual(product['gpg']['gpg-key-id'], gpg_key['id']) for repo in repos: repo = Repository.info({'id': repo['id']}) self.assertEqual(repo['gpg-key']['id'], gpg_key['id'])
def test_positive_update_gpg_key(self): """Update product's gpg keys @id: e7febd14-ac8b-424e-9ddf-bf0f63ebe430 @Assert: Product gpg key is updated """ first_gpg_key = make_gpg_key({u'organization-id': self.org['id']}) second_gpg_key = make_gpg_key({u'organization-id': self.org['id']}) product = make_product({ u'gpg-key-id': first_gpg_key['id'], u'organization-id': self.org['id'], }) # Update the Descriptions Product.update({ u'gpg-key-id': second_gpg_key['id'], u'id': product['id'], }) # Fetch it product = Product.info({ u'id': product['id'], u'organization-id': self.org['id'], }) self.assertEqual(product['gpg']['gpg-key-id'], second_gpg_key['id']) self.assertNotEqual(product['gpg']['gpg-key-id'], first_gpg_key['id'])
def test_positive_update_3(self): """@Test: Update product's sync plan @Feature: Product @Assert: Product sync plan is updated """ first_sync_plan = make_sync_plan({u'organization-id': self.org['id']}) second_sync_plan = make_sync_plan({u'organization-id': self.org['id']}) product = make_product({ u'organization-id': self.org['id'], u'sync-plan-id': first_sync_plan['id'], }) # Update the Descriptions Product.update({ u'id': product['id'], u'sync-plan-id': second_sync_plan['id'], }) # Fetch it product = Product.info({ u'id': product['id'], u'organization-id': self.org['id'], }) self.assertEqual(product['sync-plan-id'], second_sync_plan['id']) self.assertNotEqual(product['sync-plan-id'], first_sync_plan['id'])
def test_positive_add_product_with_repo(module_org): """Create gpg key with valid name and valid gpg key via file import then associate it with custom product that has one repository :id: f315eadd-e65b-4952-912f-f640867ad656 :expectedresults: gpg key is associated with product as well as with the repository :CaseLevel: Integration """ product = make_product({'organization-id': module_org.id}) repo = make_repository({'product-id': product['id']}) gpg_key = make_content_credential({'organization-id': module_org.id}) Product.update({ 'gpg-key': gpg_key['name'], 'id': product['id'], 'organization-id': module_org.id }) product = Product.info({ 'id': product['id'], 'organization-id': module_org.id }) repo = Repository.info({'id': repo['id']}) assert product['gpg']['gpg-key-id'] == gpg_key['id'] assert repo['gpg-key']['id'] == gpg_key['id']
def test_positive_add_product_with_repos(module_org): """Create gpg key with valid name and valid gpg key via file import then associate it with custom product that has more than one repository :id: 76683f3e-7705-4719-996e-c026839053bb :expectedresults: gpg key is associated with product as well as with the repositories :CaseLevel: Integration """ product = make_product({'organization-id': module_org.id}) repos = [ make_repository({'product-id': product['id']}) for _ in range(gen_integer(2, 5)) ] gpg_key = make_content_credential({'organization-id': module_org.id}) Product.update({ 'gpg-key': gpg_key['name'], 'id': product['id'], 'organization-id': module_org.id }) product = Product.info({ 'id': product['id'], 'organization-id': module_org.id }) assert product['gpg']['gpg-key-id'] == gpg_key['id'] for repo in repos: repo = Repository.info({'id': repo['id']}) assert repo['gpg-key']['id'] == gpg_key['id']
def test_positive_update_2(self): """@Test: Update product's gpg keys @Feature: Product @Assert: Product gpg key is updated """ first_gpg_key = make_gpg_key({u'organization-id': self.org['id']}) second_gpg_key = make_gpg_key({u'organization-id': self.org['id']}) product = make_product({ u'gpg-key-id': first_gpg_key['id'], u'organization-id': self.org['id'], }) # Update the Descriptions Product.update({ u'gpg-key-id': second_gpg_key['id'], u'id': product['id'], }) # Fetch it product = Product.info({ u'id': product['id'], u'organization-id': self.org['id'], }) self.assertEqual(product['gpg']['gpg-key-id'], second_gpg_key['id']) self.assertNotEqual(product['gpg']['gpg-key-id'], first_gpg_key['id'])
def test_positive_add_product_with_repo(self): """Create gpg key with valid name and valid gpg key via file import then associate it with custom product that has one repository :id: 5529a852-9ef6-48f8-b2bc-2bbf463657dd :expectedresults: gpg key is associated with product as well as with the repository :CaseLevel: Integration """ product = make_product({'organization-id': self.org['id']}) repo = make_repository({'product-id': product['id']}) gpg_key = make_gpg_key({'organization-id': self.org['id']}) Product.update({ 'gpg-key': gpg_key['name'], 'id': product['id'], 'organization-id': self.org['id'], }) product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'], }) repo = Repository.info({'id': repo['id']}) self.assertEqual(product['gpg']['gpg-key-id'], gpg_key['id']) self.assertEqual(repo['gpg-key']['id'], gpg_key['id'])
def test_positive_add_product_with_repo(self): """Create gpg key with valid name and valid gpg key via file import then associate it with custom product that has one repository @id: 5529a852-9ef6-48f8-b2bc-2bbf463657dd @assert: gpg key is associated with product as well as with the repository @CaseLevel: Integration """ product = make_product({'organization-id': self.org['id']}) repo = make_repository({'product-id': product['id']}) gpg_key = make_gpg_key({'organization-id': self.org['id']}) Product.update({ 'gpg-key': gpg_key['name'], 'id': product['id'], 'organization-id': self.org['id'], }) product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'], }) repo = Repository.info({'id': repo['id']}) self.assertEqual(product['gpg']['gpg-key-id'], gpg_key['id']) self.assertEqual(repo['gpg-key']['id'], gpg_key['id'])
def test_positive_update_sync_plan(self): """Update product's sync plan :id: 78cbde49-b6c8-41ab-8991-fcb4b648e79b :expectedresults: Product sync plan is updated :CaseImportance: Critical """ first_sync_plan = make_sync_plan({u'organization-id': self.org['id']}) second_sync_plan = make_sync_plan({u'organization-id': self.org['id']}) product = make_product({ u'organization-id': self.org['id'], u'sync-plan-id': first_sync_plan['id'], }) # Update the Descriptions Product.update({ u'id': product['id'], u'sync-plan-id': second_sync_plan['id'], }) # Fetch it product = Product.info({ u'id': product['id'], u'organization-id': self.org['id'], }) self.assertEqual(product['sync-plan-id'], second_sync_plan['id']) self.assertNotEqual(product['sync-plan-id'], first_sync_plan['id'])
def test_positive_update_sync_plan(self): """Update product's sync plan @id: 78cbde49-b6c8-41ab-8991-fcb4b648e79b @Assert: Product sync plan is updated """ first_sync_plan = make_sync_plan({u'organization-id': self.org['id']}) second_sync_plan = make_sync_plan({u'organization-id': self.org['id']}) product = make_product({ u'organization-id': self.org['id'], u'sync-plan-id': first_sync_plan['id'], }) # Update the Descriptions Product.update({ u'id': product['id'], u'sync-plan-id': second_sync_plan['id'], }) # Fetch it product = Product.info({ u'id': product['id'], u'organization-id': self.org['id'], }) self.assertEqual(product['sync-plan-id'], second_sync_plan['id']) self.assertNotEqual(product['sync-plan-id'], first_sync_plan['id'])
def test_positive_update_key_for_product_with_repos(module_org): """Create gpg key with valid name and valid gpg key via file import then associate it with custom product that has more than one repository then update the key :id: 8aa3dc75-6257-48ae-b3f9-c617e323b47a :expectedresults: gpg key is associated with product before/after update as well as with the repositories :CaseLevel: Integration """ # Create a product and a gpg key product = make_product({'organization-id': module_org.id}) gpg_key = make_content_credential({'organization-id': module_org.id}) # Create repositories and assign them to the product repos = [ make_repository({'product-id': product['id']}) for _ in range(gen_integer(2, 5)) ] # Associate gpg key with a product Product.update({ 'gpg-key': gpg_key['name'], 'id': product['id'], 'organization-id': module_org.id }) # Verify gpg key was associated product = Product.info({ 'id': product['id'], 'organization-id': module_org.id }) assert product['gpg']['gpg-key'] == gpg_key['name'] for repo in repos: repo = Repository.info({'id': repo['id']}) assert repo['gpg-key'].get('name') == gpg_key['name'] # Update the gpg key new_name = gen_choice(list(valid_data_list().values())) ContentCredential.update({ 'name': gpg_key['name'], 'new-name': new_name, 'organization-id': module_org.id }) # Verify changes are reflected in the gpg key gpg_key = ContentCredential.info({ 'id': gpg_key['id'], 'organization-id': module_org.id }) assert gpg_key['name'] == new_name # Verify changes are reflected in the product product = Product.info({ 'id': product['id'], 'organization-id': module_org.id }) assert product['gpg']['gpg-key'] == new_name # Verify changes are reflected in the repositories for repo in repos: repo = Repository.info({'id': repo['id']}) assert repo['gpg-key'].get('name') == new_name
def test_positive_update_key_for_product_with_repos(self): """Create gpg key with valid name and valid gpg key via file import then associate it with custom product that has more than one repository then update the key @id: a95eb51b-4b6b-4c04-bb4d-cbe600431850 @assert: gpg key is associated with product before/after update as well as with the repositories @CaseLevel: Integration """ # Create a product and a gpg key product = make_product({'organization-id': self.org['id']}) gpg_key = make_gpg_key({'organization-id': self.org['id']}) # Create repositories and assign them to the product repos = [ make_repository({'product-id': product['id']}) for _ in range(gen_integer(2, 5)) ] # Associate gpg key with a product Product.update({ 'gpg-key': gpg_key['name'], 'id': product['id'], 'organization-id': self.org['id'], }) # Verify gpg key was associated product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'], }) self.assertEqual(product['gpg']['gpg-key'], gpg_key['name']) for repo in repos: repo = Repository.info({'id': repo['id']}) self.assertEqual(repo['gpg-key'].get('name'), gpg_key['name']) # Update the gpg key new_name = gen_choice(valid_data_list()) GPGKey.update({ 'name': gpg_key['name'], 'new-name': new_name, 'organization-id': self.org['id'], }) # Verify changes are reflected in the gpg key gpg_key = GPGKey.info({ 'id': gpg_key['id'], 'organization-id': self.org['id'], }) self.assertEqual(gpg_key['name'], new_name) # Verify changes are reflected in the product product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'], }) self.assertEqual(product['gpg']['gpg-key'], new_name) # Verify changes are reflected in the repositories for repo in repos: repo = Repository.info({'id': repo['id']}) self.assertEqual(repo['gpg-key'].get('name'), new_name)
def test_positive_update_key_for_product_with_repos(self): """Create gpg key with valid name and valid gpg key via file import then associate it with custom product that has more than one repository then update the key :id: a95eb51b-4b6b-4c04-bb4d-cbe600431850 :expectedresults: gpg key is associated with product before/after update as well as with the repositories :CaseLevel: Integration """ # Create a product and a gpg key product = make_product({'organization-id': self.org['id']}) gpg_key = make_gpg_key({'organization-id': self.org['id']}) # Create repositories and assign them to the product repos = [ make_repository({'product-id': product['id']}) for _ in range(gen_integer(2, 5)) ] # Associate gpg key with a product Product.update({ 'gpg-key': gpg_key['name'], 'id': product['id'], 'organization-id': self.org['id'], }) # Verify gpg key was associated product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'], }) self.assertEqual(product['gpg']['gpg-key'], gpg_key['name']) for repo in repos: repo = Repository.info({'id': repo['id']}) self.assertEqual(repo['gpg-key'].get('name'), gpg_key['name']) # Update the gpg key new_name = gen_choice(valid_data_list()) GPGKey.update({ 'name': gpg_key['name'], 'new-name': new_name, 'organization-id': self.org['id'], }) # Verify changes are reflected in the gpg key gpg_key = GPGKey.info({ 'id': gpg_key['id'], 'organization-id': self.org['id'], }) self.assertEqual(gpg_key['name'], new_name) # Verify changes are reflected in the product product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'], }) self.assertEqual(product['gpg']['gpg-key'], new_name) # Verify changes are reflected in the repositories for repo in repos: repo = Repository.info({'id': repo['id']}) self.assertEqual(repo['gpg-key'].get('name'), new_name)
def test_positive_delete_key_for_product_with_repos(module_org): """Create gpg key with valid name and valid gpg key via file import then associate it with custom product that has more than one repository then delete it :id: 3848441f-746a-424c-afc3-4d5a15888af8 :expectedresults: gpg key is associated with product and its repositories during creation but removed from the product and the repositories after deletion :CaseLevel: Integration """ # Create product, repositories and gpg key product = make_product({'organization-id': module_org.id}) repos = [ make_repository({'product-id': product['id']}) for _ in range(gen_integer(2, 5)) ] gpg_key = make_content_credential({'organization-id': module_org.id}) # Associate gpg key with a product Product.update({ 'gpg-key': gpg_key['name'], 'id': product['id'], 'organization-id': module_org.id }) # Verify gpg key was associated with product and its repositories product = Product.info({ 'id': product['id'], 'organization-id': module_org.id }) assert product['gpg']['gpg-key'] == gpg_key['name'] for repo in repos: repo = Repository.info({'id': repo['id']}) assert repo['gpg-key'].get('name') == gpg_key['name'] # Delete the gpg key ContentCredential.delete({ 'name': gpg_key['name'], 'organization-id': module_org.id }) # Verify gpg key was actually deleted with pytest.raises(CLIReturnCodeError): ContentCredential.info({ 'id': gpg_key['id'], 'organization-id': module_org.id }) # Verify gpg key was disassociated from the product and its # repositories product = Product.info({ 'id': product['id'], 'organization-id': module_org.id }) assert product['gpg']['gpg-key'] != gpg_key['name'] for repo in repos: repo = Repository.info({'id': repo['id']}) assert repo['gpg-key'].get('name') != gpg_key['name']
def test_positive_delete_key_for_product_with_repos(self): """Create gpg key with valid name and valid gpg key via file import then associate it with custom product that has more than one repository then delete it :id: f92d4643-1892-4f95-ae6b-fcea8e726946 :expectedresults: gpg key is associated with product and its repositories during creation but removed from the product and the repositories after deletion :CaseLevel: Integration """ # Create product, repositories and gpg key product = make_product({'organization-id': self.org['id']}) repos = [ make_repository({'product-id': product['id']}) for _ in range(gen_integer(2, 5)) ] gpg_key = make_gpg_key({'organization-id': self.org['id']}) # Associate gpg key with a product Product.update({ 'gpg-key': gpg_key['name'], 'id': product['id'], 'organization-id': self.org['id'], }) # Verify gpg key was associated with product and its repositories product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'], }) self.assertEqual(product['gpg']['gpg-key'], gpg_key['name']) for repo in repos: repo = Repository.info({'id': repo['id']}) self.assertEqual(repo['gpg-key'].get('name'), gpg_key['name']) # Delete the gpg key GPGKey.delete({ 'name': gpg_key['name'], 'organization-id': self.org['id'], }) # Verify gpg key was actually deleted with self.assertRaises(CLIReturnCodeError): GPGKey.info({ 'id': gpg_key['id'], 'organization-id': self.org['id'], }) # Verify gpg key was disassociated from the product and its # repositories product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'], }) self.assertNotEqual(product['gpg']['gpg-key'], gpg_key['name']) for repo in repos: repo = Repository.info({'id': repo['id']}) self.assertNotEqual(repo['gpg-key'].get('name'), gpg_key['name'])
def test_positive_delete_key_for_product_with_repos(self): """Create gpg key with valid name and valid gpg key via file import then associate it with custom product that has more than one repository then delete it @id: f92d4643-1892-4f95-ae6b-fcea8e726946 @assert: gpg key is associated with product and its repositories during creation but removed from the product and the repositories after deletion @CaseLevel: Integration """ # Create product, repositories and gpg key product = make_product({'organization-id': self.org['id']}) repos = [ make_repository({'product-id': product['id']}) for _ in range(gen_integer(2, 5)) ] gpg_key = make_gpg_key({'organization-id': self.org['id']}) # Associate gpg key with a product Product.update({ 'gpg-key': gpg_key['name'], 'id': product['id'], 'organization-id': self.org['id'], }) # Verify gpg key was associated with product and its repositories product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'], }) self.assertEqual(product['gpg']['gpg-key'], gpg_key['name']) for repo in repos: repo = Repository.info({'id': repo['id']}) self.assertEqual(repo['gpg-key'].get('name'), gpg_key['name']) # Delete the gpg key GPGKey.delete({ 'name': gpg_key['name'], 'organization-id': self.org['id'], }) # Verify gpg key was actually deleted with self.assertRaises(CLIReturnCodeError): GPGKey.info({ 'id': gpg_key['id'], 'organization-id': self.org['id'], }) # Verify gpg key was disassociated from the product and its # repositories product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'], }) self.assertNotEqual(product['gpg']['gpg-key'], gpg_key['name']) for repo in repos: repo = Repository.info({'id': repo['id']}) self.assertNotEqual(repo['gpg-key'].get('name'), gpg_key['name'])
def test_positive_update_key_for_product_with_repo(self): """Create gpg key with valid name and valid gpg key via file import then associate it with custom product that has one repository then update the key :id: 3fb550a7-507e-4988-beb6-35bdfc2e99a8 :expectedresults: gpg key is associated with product before/after update as well as with the repository :CaseLevel: Integration """ # Create a product and a gpg key product = make_product({'organization-id': self.org['id']}) gpg_key = make_gpg_key({'organization-id': self.org['id']}) # Create a repository and assign it to the product repo = make_repository({'product-id': product['id']}) # Associate gpg key with a product Product.update({ 'gpg-key': gpg_key['name'], 'id': product['id'], 'organization-id': self.org['id'], }) # Verify gpg key was associated product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'], }) repo = Repository.info({'id': repo['id']}) self.assertEqual(product['gpg']['gpg-key'], gpg_key['name']) self.assertEqual(repo['gpg-key'].get('name'), gpg_key['name']) # Update the gpg key new_name = gen_choice(valid_data_list()) GPGKey.update({ 'name': gpg_key['name'], 'new-name': new_name, 'organization-id': self.org['id'], }) # Verify changes are reflected in the gpg key gpg_key = GPGKey.info({ 'id': gpg_key['id'], 'organization-id': self.org['id'], }) self.assertEqual(gpg_key['name'], new_name) # Verify changes are reflected in the product product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'], }) self.assertEqual(product['gpg']['gpg-key'], new_name) # Verify changes are reflected in the repository repo = Repository.info({'id': repo['id']}) self.assertEqual(repo['gpg-key'].get('id'), gpg_key['id'])
def test_positive_update_key_for_product_with_repo(self): """Create gpg key with valid name and valid gpg key via file import then associate it with custom product that has one repository then update the key @id: 3fb550a7-507e-4988-beb6-35bdfc2e99a8 @assert: gpg key is associated with product before/after update as well as with the repository @CaseLevel: Integration """ # Create a product and a gpg key product = make_product({'organization-id': self.org['id']}) gpg_key = make_gpg_key({'organization-id': self.org['id']}) # Create a repository and assign it to the product repo = make_repository({'product-id': product['id']}) # Associate gpg key with a product Product.update({ 'gpg-key': gpg_key['name'], 'id': product['id'], 'organization-id': self.org['id'], }) # Verify gpg key was associated product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'], }) repo = Repository.info({'id': repo['id']}) self.assertEqual(product['gpg']['gpg-key'], gpg_key['name']) self.assertEqual(repo['gpg-key'].get('name'), gpg_key['name']) # Update the gpg key new_name = gen_choice(valid_data_list()) GPGKey.update({ 'name': gpg_key['name'], 'new-name': new_name, 'organization-id': self.org['id'], }) # Verify changes are reflected in the gpg key gpg_key = GPGKey.info({ 'id': gpg_key['id'], 'organization-id': self.org['id'], }) self.assertEqual(gpg_key['name'], new_name) # Verify changes are reflected in the product product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'], }) self.assertEqual(product['gpg']['gpg-key'], new_name) # Verify changes are reflected in the repository repo = Repository.info({'id': repo['id']}) self.assertEqual(repo['gpg-key'].get('id'), gpg_key['id'])
def test_positive_update_key_for_product_with_repo(module_org): """Create gpg key with valid name and valid gpg key via file import then associate it with custom product that has one repository then update the key :id: 1f8f943c-a611-4ed2-9d8a-770f60a549a7 :expectedresults: gpg key is associated with product before/after update as well as with the repository :CaseLevel: Integration """ # Create a product and a gpg key product = make_product({'organization-id': module_org.id}) gpg_key = make_content_credential({'organization-id': module_org.id}) # Create a repository and assign it to the product repo = make_repository({'product-id': product['id']}) # Associate gpg key with a product Product.update({ 'gpg-key': gpg_key['name'], 'id': product['id'], 'organization-id': module_org.id }) # Verify gpg key was associated product = Product.info({ 'id': product['id'], 'organization-id': module_org.id }) repo = Repository.info({'id': repo['id']}) assert product['gpg']['gpg-key'] == gpg_key['name'] assert repo['gpg-key'].get('name') == gpg_key['name'] # Update the gpg key new_name = gen_choice(list(valid_data_list().values())) ContentCredential.update({ 'name': gpg_key['name'], 'new-name': new_name, 'organization-id': module_org.id }) # Verify changes are reflected in the gpg key gpg_key = ContentCredential.info({ 'id': gpg_key['id'], 'organization-id': module_org.id }) assert gpg_key['name'] == new_name # Verify changes are reflected in the product product = Product.info({ 'id': product['id'], 'organization-id': module_org.id }) assert product['gpg']['gpg-key'] == new_name # Verify changes are reflected in the repository repo = Repository.info({'id': repo['id']}) assert repo['gpg-key'].get('id') == gpg_key['id']
def test_positive_update_1(self): """@Test: Update the description of a product @Feature: Product @Assert: Product description is updated """ product = make_product({u"organization-id": self.org["id"]}) for desc in valid_data_list(): with self.subTest(desc): Product.update({u"description": desc, u"id": product["id"]}) result = Product.info({u"id": product["id"], u"organization-id": self.org["id"]}) self.assertEqual(result["description"], desc)
def test_positive_delete_key_for_product_with_repo(self): """Create gpg key with valid name and valid gpg key via file import then associate it with custom product that has one repository then delete it :id: a5d4ea02-f015-4026-b4dc-7365eaf00049 :expectedresults: gpg key is associated with product but and its repository during creation but removed from product and repository after deletion :CaseLevel: Integration """ # Create product, repository and gpg key product = make_product({'organization-id': self.org['id']}) repo = make_repository({'product-id': product['id']}) gpg_key = make_gpg_key({'organization-id': self.org['id']}) # Associate gpg key with a product Product.update({ 'gpg-key': gpg_key['name'], 'id': product['id'], 'organization-id': self.org['id'], }) # Verify gpg key was associated both with product and its repository product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'], }) repo = Repository.info({'id': repo['id']}) self.assertEqual(product['gpg']['gpg-key'], gpg_key['name']) self.assertEqual(repo['gpg-key'].get('name'), gpg_key['name']) # Delete the gpg key GPGKey.delete({ 'name': gpg_key['name'], 'organization-id': self.org['id'], }) # Verify gpg key was actually deleted with self.assertRaises(CLIReturnCodeError): GPGKey.info({ 'id': gpg_key['id'], 'organization-id': self.org['id'], }) # Verify gpg key was disassociated from the product and its repository product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'], }) repo = Repository.info({'id': repo['id']}) self.assertNotEqual(product['gpg']['gpg-key'], gpg_key['name']) self.assertNotEqual(repo['gpg-key'].get('name'), gpg_key['name'])
def test_positive_delete_key_for_product_with_repo(module_org): """Create gpg key with valid name and valid gpg key via file import then associate it with custom product that has one repository then delete it :id: 1e98e588-8b5d-475c-ad84-5d566df5619c :expectedresults: gpg key is associated with product but and its repository during creation but removed from product and repository after deletion :CaseLevel: Integration """ # Create product, repository and gpg key product = make_product({'organization-id': module_org.id}) repo = make_repository({'product-id': product['id']}) gpg_key = make_content_credential({'organization-id': module_org.id}) # Associate gpg key with a product Product.update({ 'gpg-key': gpg_key['name'], 'id': product['id'], 'organization-id': module_org.id }) # Verify gpg key was associated both with product and its repository product = Product.info({ 'id': product['id'], 'organization-id': module_org.id }) repo = Repository.info({'id': repo['id']}) assert product['gpg']['gpg-key'] == gpg_key['name'] assert repo['gpg-key'].get('name') == gpg_key['name'] # Delete the gpg key ContentCredential.delete({ 'name': gpg_key['name'], 'organization-id': module_org.id }) # Verify gpg key was actually deleted with pytest.raises(CLIReturnCodeError): ContentCredential.info({ 'id': gpg_key['id'], 'organization-id': module_org.id }) # Verify gpg key was disassociated from the product and its repository product = Product.info({ 'id': product['id'], 'organization-id': module_org.id }) repo = Repository.info({'id': repo['id']}) assert product['gpg']['gpg-key'] != gpg_key['name'] assert repo['gpg-key'].get('name') != gpg_key['name']
def test_positive_update_2(self): """@Test: Update product's gpg keys @Feature: Product @Assert: Product gpg key is updated """ first_gpg_key = make_gpg_key({u"organization-id": self.org["id"]}) second_gpg_key = make_gpg_key({u"organization-id": self.org["id"]}) product = make_product({u"gpg-key-id": first_gpg_key["id"], u"organization-id": self.org["id"]}) # Update the Descriptions Product.update({u"gpg-key-id": second_gpg_key["id"], u"id": product["id"]}) # Fetch it product = Product.info({u"id": product["id"], u"organization-id": self.org["id"]}) self.assertEqual(product["gpg"]["gpg-key-id"], second_gpg_key["id"]) self.assertNotEqual(product["gpg"]["gpg-key-id"], first_gpg_key["id"])
def test_positive_update_1(self, test_data): """@Test: Update the description of a product @Feature: Product @Assert: Product description is updated """ product = make_product({ u'organization-id': self.org['id'], }) # Update the Descriptions result = Product.update({ u'id': product['id'], u'description': test_data['description'], }) # Fetch it result = Product.info({ u'id': product['id'], u'organization-id': self.org['id'], }) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) self.assertEqual( result.stdout['description'], test_data['description']) self.assertNotEqual( product['description'], result.stdout['description'])
def test_key_associate_16(self): """@test: Create gpg key with valid name and valid gpg key via file import then associate it with custom product that has one repository then delete it @feature: GPG Keys @assert: gpg key is associated with product but and its repository during creation but removed from product and repository after deletion """ # Create product, repository and gpg key product = make_product({'organization-id': self.org['id']}) repo = make_repository({'product-id': product['id']}) gpg_key = make_gpg_key({'organization-id': self.org['id']}) # Associate gpg key with a product Product.update({ 'gpg-key': gpg_key['name'], 'id': product['id'], 'organization-id': self.org['id'], }) # Verify gpg key was associated both with product and its repository product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'], }) repo = Repository.info({'id': repo['id']}) self.assertEqual(product['gpg']['gpg-key'], gpg_key['name']) self.assertEqual(repo['gpg-key'].get('name'), gpg_key['name']) # Delete the gpg key GPGKey.delete({ 'name': gpg_key['name'], 'organization-id': self.org['id'], }) # Verify gpg key was actually deleted with self.assertRaises(CLIReturnCodeError): GPGKey.info({ 'id': gpg_key['id'], 'organization-id': self.org['id'], }) # Verify gpg key was disassociated from the product and its repository product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'], }) repo = Repository.info({'id': repo['id']}) self.assertNotEqual(product['gpg']['gpg-key'], gpg_key['name']) self.assertNotEqual(repo['gpg-key'].get('name'), gpg_key['name'])
def test_positive_update_key_for_empty_product(self): """Create gpg key with valid name and valid gpg key via file import then associate it with empty (no repos) custom product then update the key :id: c0c84c45-21fc-4940-9d52-00babb807ec7 :expectedresults: gpg key is associated with product before/after update :CaseLevel: Integration """ # Create a product and a gpg key product = make_product({'organization-id': self.org['id']}) gpg_key = make_gpg_key({'organization-id': self.org['id']}) # Associate gpg key with a product Product.update({ 'gpg-key': gpg_key['name'], 'id': product['id'], 'organization-id': self.org['id'], }) # Verify gpg key was associated product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'], }) self.assertEqual(product['gpg']['gpg-key'], gpg_key['name']) # Update the gpg key new_name = gen_choice(valid_data_list()) GPGKey.update({ 'name': gpg_key['name'], 'new-name': new_name, 'organization-id': self.org['id'], }) # Verify changes are reflected in the gpg key gpg_key = GPGKey.info({ 'id': gpg_key['id'], 'organization-id': self.org['id'], }) self.assertEqual(gpg_key['name'], new_name) # Verify changes are reflected in the product product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'], }) self.assertEqual(product['gpg']['gpg-key'], new_name)
def test_positive_update_key_for_empty_product(module_org): """Create gpg key with valid name and valid gpg key via file import then associate it with empty (no repos) custom product then update the key :id: 13aa6e0c-4255-483a-af33-ea7e82ee7766 :expectedresults: gpg key is associated with product before/after update :CaseLevel: Integration """ # Create a product and a gpg key product = make_product({'organization-id': module_org.id}) gpg_key = make_content_credential({'organization-id': module_org.id}) # Associate gpg key with a product Product.update({ 'gpg-key': gpg_key['name'], 'id': product['id'], 'organization-id': module_org.id }) # Verify gpg key was associated product = Product.info({ 'id': product['id'], 'organization-id': module_org.id }) assert product['gpg']['gpg-key'] == gpg_key['name'] # Update the gpg key new_name = gen_choice(list(valid_data_list().values())) ContentCredential.update({ 'name': gpg_key['name'], 'new-name': new_name, 'organization-id': module_org.id }) # Verify changes are reflected in the gpg key gpg_key = ContentCredential.info({ 'id': gpg_key['id'], 'organization-id': module_org.id }) assert gpg_key['name'] == new_name # Verify changes are reflected in the product product = Product.info({ 'id': product['id'], 'organization-id': module_org.id }) assert product['gpg']['gpg-key'] == new_name
def test_positive_update_description(self): """@Test: Update the description of a product @Feature: Product @Assert: Product description is updated """ product = make_product({u'organization-id': self.org['id']}) for desc in valid_data_list(): with self.subTest(desc): Product.update({ u'description': desc, u'id': product['id'], }) result = Product.info({ u'id': product['id'], u'organization-id': self.org['id'], }) self.assertEqual(result['description'], desc)
def test_positive_update_key_for_empty_product(self): """@test: Create gpg key with valid name and valid gpg key via file import then associate it with empty (no repos) custom product then update the key @feature: GPG Keys @assert: gpg key is associated with product before/after update """ # Create a product and a gpg key product = make_product({'organization-id': self.org['id']}) gpg_key = make_gpg_key({'organization-id': self.org['id']}) # Associate gpg key with a product Product.update({ 'gpg-key': gpg_key['name'], 'id': product['id'], 'organization-id': self.org['id'], }) # Verify gpg key was associated product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'], }) self.assertEqual(product['gpg']['gpg-key'], gpg_key['name']) # Update the gpg key new_name = gen_choice(valid_data_list()) GPGKey.update({ 'name': gpg_key['name'], 'new-name': new_name, 'organization-id': self.org['id'], }) # Verify changes are reflected in the gpg key gpg_key = GPGKey.info({ 'id': gpg_key['id'], 'organization-id': self.org['id'], }) self.assertEqual(gpg_key['name'], new_name) # Verify changes are reflected in the product product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'], }) self.assertEqual(product['gpg']['gpg-key'], new_name)
def test_positive_update_description(self): """Update the description of a product @id: 4b3b4c5b-3eaa-4b9c-93c6-6ee9d62061eb @Assert: Product description is updated """ product = make_product({u'organization-id': self.org['id']}) for desc in valid_data_list(): with self.subTest(desc): Product.update({ u'description': desc, u'id': product['id'], }) result = Product.info({ u'id': product['id'], u'organization-id': self.org['id'], }) self.assertEqual(result['description'], desc)
def test_positive_update_4(self): """@Test: Rename Product back to original name @Feature: Product @Assert: Product Renamed to original """ for prod_name in generate_strings_list(): with self.subTest(prod_name): prod = make_product({u"name": prod_name, u"organization-id": self.org["id"]}) new_prod_name = gen_string("alpha", 8) # Update the product name Product.update({u"id": prod["id"], u"name": new_prod_name}) # Verify Updated prod = Product.info({u"id": prod["id"], u"organization-id": self.org["id"]}) self.assertEqual(prod["name"], new_prod_name) # Now, Rename product to original Product.update({u"id": prod["id"], u"name": prod_name}) prod = Product.info({u"id": prod["id"], u"organization-id": self.org["id"]}) # Verify renamed back to Original name. self.assertEqual(prod["name"], prod_name)
def test_positive_update_1(self, test_data): """@Test: Update the description of a product @Feature: Product @Assert: Product description is updated @BZ: 1096320 """ new_product = make_product( { u'organization-id': self.org['id'] } ) # Fetch it result = Product.info( {u'id': new_product['id'], u'organization-id': self.org['id']}) self.assertEqual( result.return_code, 0, "Product was not found") self.assertEqual( len(result.stderr), 0, "No error was expected") # Update the Descriptions result = Product.update( {u'id': new_product['id'], u'description': test_data['description']} ) # Fetch it result = Product.info( {u'id': new_product['id'], u'organization-id': self.org['id']}) self.assertEqual( result.return_code, 0, "Product was not found") self.assertEqual( len(result.stderr), 0, "No error was expected") self.assertEqual( result.stdout['description'], test_data['description'], "Description was not updated" ) self.assertNotEqual( result.stdout['description'], new_product['description'], "Descriptions should not match" )
def test_positive_update_4(self, prod_name): """@Test: Rename Product back to original name @Feature: Product @Assert: Product Renamed to original """ prod = make_product({ u'name': prod_name, u'organization-id': self.org['id'], }) new_prod_name = gen_string('alpha', 8) # Update the product name Product.update({ u'id': prod['id'], u'name': new_prod_name, }) # Verify Updated result = Product.info({ u'id': prod['id'], u'organization-id': self.org['id'], }) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) self.assertEqual(result.stdout['name'], new_prod_name) # Now, Rename product to original Product.update({ u'id': prod['id'], u'name': prod_name, }) result = Product.info({ u'id': prod['id'], u'organization-id': self.org['id'], }) # Verify renamed back to Original name. self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) self.assertEqual(result.stdout['name'], prod_name)
def test_positive_update_name(self): """Rename Product back to original name :id: 4dec056b-8084-4372-bf7a-ce1db0c47cc9 :expectedresults: Product Renamed to original :CaseImportance: Critical """ for prod_name in generate_strings_list(): with self.subTest(prod_name): prod = make_product({ u'name': prod_name, u'organization-id': self.org['id'], }) new_prod_name = gen_string('alpha', 8) # Update the product name Product.update({ u'id': prod['id'], u'name': new_prod_name, }) # Verify Updated prod = Product.info({ u'id': prod['id'], u'organization-id': self.org['id'], }) self.assertEqual(prod['name'], new_prod_name) # Now, Rename product to original Product.update({ u'id': prod['id'], u'name': prod_name, }) prod = Product.info({ u'id': prod['id'], u'organization-id': self.org['id'], }) # Verify renamed back to Original name. self.assertEqual(prod['name'], prod_name)
def test_positive_update_1(self, test_data): """@Test: Update the description of a product @Feature: Product @Assert: Product description is updated """ new_product = make_product( { u'organization-id': self.org['id'] } ) # Fetch it result = Product.info( {u'id': new_product['id'], u'organization-id': self.org['id']}) self.assertEqual( result.return_code, 0, "Product was not found") self.assertEqual( len(result.stderr), 0, "No error was expected") # Update the Descriptions result = Product.update( {u'id': new_product['id'], u'description': test_data['description']} ) # Fetch it result = Product.info( {u'id': new_product['id'], u'organization-id': self.org['id']}) self.assertEqual( result.return_code, 0, "Product was not found") self.assertEqual( len(result.stderr), 0, "No error was expected") self.assertEqual( result.stdout['description'], test_data['description'], "Description was not updated" ) self.assertNotEqual( result.stdout['description'], new_product['description'], "Descriptions should not match" )
def test_positive_update_name(self): """@Test: Rename Product back to original name @Feature: Product @Assert: Product Renamed to original """ for prod_name in generate_strings_list(): with self.subTest(prod_name): prod = make_product({ u'name': prod_name, u'organization-id': self.org['id'], }) new_prod_name = gen_string('alpha', 8) # Update the product name Product.update({ u'id': prod['id'], u'name': new_prod_name, }) # Verify Updated prod = Product.info({ u'id': prod['id'], u'organization-id': self.org['id'], }) self.assertEqual(prod['name'], new_prod_name) # Now, Rename product to original Product.update({ u'id': prod['id'], u'name': prod_name, }) prod = Product.info({ u'id': prod['id'], u'organization-id': self.org['id'], }) # Verify renamed back to Original name. self.assertEqual(prod['name'], prod_name)
def test_key_associate_2(self): """@test: Create gpg key with valid name and valid gpg key via file import then associate it with custom product that has one repository @feature: GPG Keys @assert: gpg key is associated with product as well as with the repository """ product = make_product({'organization-id': self.org['id']}) repo = make_repository({'product-id': product['id']}) gpg_key = make_gpg_key({'organization-id': self.org['id']}) Product.update({ 'gpg-key': gpg_key['name'], 'id': product['id'], 'organization-id': self.org['id'], }) product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'], }) repo = Repository.info({'id': repo['id']}) self.assertEqual(product['gpg']['gpg-key-id'], gpg_key['id']) self.assertEqual(repo['gpg-key']['id'], gpg_key['id'])
def test_positive_update_name(self): """Rename Product back to original name @Feature: Product @Assert: Product Renamed to original """ for prod_name in generate_strings_list(): with self.subTest(prod_name): prod = make_product({ u'name': prod_name, u'organization-id': self.org['id'], }) new_prod_name = gen_string('alpha', 8) # Update the product name Product.update({ u'id': prod['id'], u'name': new_prod_name, }) # Verify Updated prod = Product.info({ u'id': prod['id'], u'organization-id': self.org['id'], }) self.assertEqual(prod['name'], new_prod_name) # Now, Rename product to original Product.update({ u'id': prod['id'], u'name': prod_name, }) prod = Product.info({ u'id': prod['id'], u'organization-id': self.org['id'], }) # Verify renamed back to Original name. self.assertEqual(prod['name'], prod_name)
def test_positive_CRUD(self): """Check if product can be created, updated, synchronized and deleted :id: 9d7b5ec8-59d0-4371-b5d2-d43145e4e2db :expectedresults: Product is created, updated, synchronized and deleted :BZ: 1422552 :CaseImportance: Critical """ desc = list(valid_data_list().values())[0] gpg_key = make_gpg_key({'organization-id': self.org['id']}) name = list(valid_data_list().values())[0] label = valid_labels_list()[0] sync_plan = make_sync_plan({'organization-id': self.org['id']}) product = make_product({ 'description': desc, 'gpg-key-id': gpg_key['id'], 'label': label, 'name': name, 'organization-id': self.org['id'], 'sync-plan-id': sync_plan['id'], }) self.assertEqual(product['name'], name) self.assertGreater(len(product['label']), 0) self.assertEqual(product['label'], label) self.assertEqual(product['description'], desc) self.assertEqual(product['gpg']['gpg-key-id'], gpg_key['id']) self.assertEqual(product['sync-plan-id'], sync_plan['id']) # update desc = list(valid_data_list().values())[0] new_gpg_key = make_gpg_key({'organization-id': self.org['id']}) new_sync_plan = make_sync_plan({'organization-id': self.org['id']}) new_prod_name = gen_string('alpha', 8) Product.update({ 'description': desc, 'id': product['id'], 'gpg-key-id': new_gpg_key['id'], 'sync-plan-id': new_sync_plan['id'], 'name': new_prod_name, }) product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'] }) self.assertEqual(product['name'], new_prod_name) self.assertEqual(product['description'], desc) self.assertEqual(product['gpg']['gpg-key-id'], new_gpg_key['id']) self.assertNotEqual(product['gpg']['gpg-key-id'], gpg_key['id']) self.assertEqual(product['sync-plan-id'], new_sync_plan['id']) self.assertNotEqual(product['sync-plan-id'], sync_plan['id']) # synchronize repo = make_repository({ 'product-id': product['id'], 'url': FAKE_0_YUM_REPO }) Product.synchronize({ 'id': product['id'], 'organization-id': self.org['id'] }) packages = Package.list({'product-id': product['id']}) repo = Repository.info({'id': repo['id']}) self.assertEqual(int(repo['content-counts']['packages']), len(packages)) self.assertEqual(len(packages), FAKE_0_YUM_REPO_PACKAGES_COUNT) # delete Product.remove_sync_plan({'id': product['id']}) product = Product.info({ 'id': product['id'], 'organization-id': self.org['id'] }) self.assertEqual(len(product['sync-plan-id']), 0) Product.delete({'id': product['id']}) wait_for_tasks( search_query='label = Actions::Katello::Product::Destroy' ' and resource_id = {}'.format(product['id']), max_tries=10, ) with self.assertRaises(CLIReturnCodeError): Product.info({ 'id': product['id'], 'organization-id': self.org['id'] })
def test_positive_update_2(self, test_name): """@Test: Update product's gpg keys @Feature: Product @Assert: Product gpg key is updated """ first_gpg_key = make_gpg_key( {u'organization-id': self.org['id']} ) second_gpg_key = make_gpg_key( {u'organization-id': self.org['id']} ) new_product = make_product( { u'name': test_name['name'], u'organization-id': self.org['id'], } ) # Fetch it result = Product.info( {u'id': new_product['id'], u'organization-id': self.org['id']}) self.assertEqual( result.return_code, 0, "Product was not found") self.assertEqual( len(result.stderr), 0, "No error was expected") # No gpg key yet self.assertEqual( len(result.stdout['gpg']['gpg-key-id']), 0, "No gpg key expected" ) # Add first gpg key to product result = Product.update( {u'id': new_product['id'], u'gpg-key-id': first_gpg_key['id']} ) # Fetch it result = Product.info( {u'id': new_product['id'], u'organization-id': self.org['id']}) self.assertEqual( result.return_code, 0, "Product was not found") self.assertEqual( len(result.stderr), 0, "No error was expected") self.assertEqual( result.stdout['gpg']['gpg-key-id'], first_gpg_key['id'], "GPG Keys don't match") self.assertNotEqual( result.stdout['gpg']['gpg-key-id'], second_gpg_key['id'], "GPG Keys should not match") # Remove first key by updating product to use second key result = Product.update( {u'id': new_product['id'], u'gpg-key-id': second_gpg_key['id']} ) # Fetch it result = Product.info( {u'id': new_product['id'], u'organization-id': self.org['id']}) self.assertEqual( result.return_code, 0, "Product was not found") self.assertEqual( len(result.stderr), 0, "No error was expected") self.assertEqual( result.stdout['gpg']['gpg-key-id'], second_gpg_key['id'], "GPG Keys don't match" ) self.assertNotEqual( result.stdout['gpg']['gpg-key-id'], first_gpg_key['id'], "GPG Keys should not match")
def test_positive_update_3(self, test_name): """@Test: Update product's sync plan @Feature: Product @Assert: Product sync plan is updated """ first_sync_plan = make_sync_plan( {u'organization-id': self.org['id']} ) second_sync_plan = make_sync_plan( {u'organization-id': self.org['id']} ) new_product = make_product( { u'name': test_name['name'], u'organization-id': self.org['id'], } ) # Fetch it result = Product.info( {u'id': new_product['id'], u'organization-id': self.org['id']}) self.assertEqual( result.return_code, 0, "Product was not found") self.assertEqual( len(result.stderr), 0, "No error was expected") # No sync plan yet self.assertEqual( len(result.stdout['sync-plan-id']), 0, "No sync plan expected" ) # Add first sync plan to product result = Product.update( {u'id': new_product['id'], u'sync-plan-id': first_sync_plan['id']} ) # Fetch it result = Product.info( {u'id': new_product['id'], u'organization-id': self.org['id']}) self.assertEqual( result.return_code, 0, "Product was not found") self.assertEqual( len(result.stderr), 0, "No error was expected") self.assertEqual( result.stdout['sync-plan-id'], first_sync_plan['id'], "Sync plans don't match") self.assertNotEqual( result.stdout['sync-plan-id'], second_sync_plan['id'], "Sync plans should not match") # Remove first sync plan by updating product to use second plan result = Product.update( {u'id': new_product['id'], u'name': new_product['name'], u'sync-plan-id': second_sync_plan['id']} ) # Fetch it result = Product.info( {u'id': new_product['id'], u'organization-id': self.org['id']}) self.assertEqual( result.return_code, 0, "Product was not found") self.assertEqual( len(result.stderr), 0, "No error was expected") self.assertEqual( result.stdout['sync-plan-id'], second_sync_plan['id'], "Sync plans don't match" ) self.assertNotEqual( result.stdout['sync-plan-id'], first_sync_plan['id'], "Sync plans should not match")
def test_positive_CRUD(module_org): """Check if product can be created, updated, synchronized and deleted :id: 9d7b5ec8-59d0-4371-b5d2-d43145e4e2db :expectedresults: Product is created, updated, synchronized and deleted :BZ: 1422552 :CaseImportance: Critical """ desc = list(valid_data_list().values())[0] gpg_key = make_content_credential({'organization-id': module_org.id}) name = list(valid_data_list().values())[0] label = valid_labels_list()[0] sync_plan = make_sync_plan({'organization-id': module_org.id}) product = make_product( { 'description': desc, 'gpg-key-id': gpg_key['id'], 'label': label, 'name': name, 'organization-id': module_org.id, 'sync-plan-id': sync_plan['id'], }, ) assert product['name'] == name assert len(product['label']) > 0 assert product['label'] == label assert product['description'] == desc assert product['gpg']['gpg-key-id'] == gpg_key['id'] assert product['sync-plan-id'] == sync_plan['id'] # update desc = list(valid_data_list().values())[0] new_gpg_key = make_content_credential({'organization-id': module_org.id}) new_sync_plan = make_sync_plan({'organization-id': module_org.id}) new_prod_name = gen_string('alpha', 8) Product.update( { 'description': desc, 'id': product['id'], 'gpg-key-id': new_gpg_key['id'], 'sync-plan-id': new_sync_plan['id'], 'name': new_prod_name, } ) product = Product.info({'id': product['id'], 'organization-id': module_org.id}) assert product['name'] == new_prod_name assert product['description'] == desc assert product['gpg']['gpg-key-id'] == new_gpg_key['id'] assert product['gpg']['gpg-key-id'] != gpg_key['id'] assert product['sync-plan-id'] == new_sync_plan['id'] assert product['sync-plan-id'] != sync_plan['id'] # synchronize repo = make_repository( { 'organization-id': module_org.id, 'product-id': product['id'], 'url': settings.repos.yum_0.url, }, ) Product.synchronize({'id': product['id'], 'organization-id': module_org.id}) packages = Package.list({'product-id': product['id']}) repo = Repository.info({'id': repo['id']}) assert int(repo['content-counts']['packages']) == len(packages) assert len(packages) == FAKE_0_YUM_REPO_PACKAGES_COUNT # delete Product.remove_sync_plan({'id': product['id']}) product = Product.info({'id': product['id'], 'organization-id': module_org.id}) assert len(product['sync-plan-id']) == 0 Product.delete({'id': product['id']}) wait_for_tasks( search_query="label = Actions::Katello::Product::Destroy" f" and resource_id = {product['id']}", max_tries=10, ) with pytest.raises(CLIReturnCodeError): Product.info({'id': product['id'], 'organization-id': module_org.id})
def test_positive_update_3(self, test_name): """ @Test: Update product's sync plan @Feature: Product @Assert: Product sync plan is updated @BZ: 1096320 """ first_sync_plan = make_sync_plan( {u'organization-id': self.org['id']} ) second_sync_plan = make_sync_plan( {u'organization-id': self.org['id']} ) new_product = make_product( { u'name': test_name['name'], u'organization-id': self.org['id'], } ) # Fetch it result = Product.info( {u'id': new_product['id'], u'organization-id': self.org['id']}) self.assertEqual( result.return_code, 0, "Product was not found") self.assertEqual( len(result.stderr), 0, "No error was expected") # No sync plan yet self.assertEqual( len(result.stdout['sync-plan-id']), 0, "No sync plan expected" ) # Add first sync plan to product result = Product.update( {u'id': new_product['id'], u'sync-plan-id': first_sync_plan['id']} ) # Fetch it result = Product.info( {u'id': new_product['id'], u'organization-id': self.org['id']}) self.assertEqual( result.return_code, 0, "Product was not found") self.assertEqual( len(result.stderr), 0, "No error was expected") self.assertEqual( result.stdout['sync-plan-id'], first_sync_plan['id'], "Sync plans don't match") self.assertNotEqual( result.stdout['sync-plan-id'], second_sync_plan['id'], "Sync plans should not match") # Remove first sync plan by updating product to use second plan result = Product.update( {u'id': new_product['id'], u'name': new_product['name'], u'sync-plan-id': second_sync_plan['id']} ) # Fetch it result = Product.info( {u'id': new_product['id'], u'organization-id': self.org['id']}) self.assertEqual( result.return_code, 0, "Product was not found") self.assertEqual( len(result.stderr), 0, "No error was expected") self.assertEqual( result.stdout['sync-plan-id'], second_sync_plan['id'], "Sync plans don't match" ) self.assertNotEqual( result.stdout['sync-plan-id'], first_sync_plan['id'], "Sync plans should not match")
def test_positive_update_2(self, test_name): """ @Test: Update product's gpg keys @Feature: Product @Assert: Product gpg key is updated @BZ: 1096320 """ first_gpg_key = make_gpg_key( {u'organization-id': self.org['id']} ) second_gpg_key = make_gpg_key( {u'organization-id': self.org['id']} ) new_product = make_product( { u'name': test_name['name'], u'organization-id': self.org['id'], } ) # Fetch it result = Product.info( {u'id': new_product['id'], u'organization-id': self.org['id']}) self.assertEqual( result.return_code, 0, "Product was not found") self.assertEqual( len(result.stderr), 0, "No error was expected") # No gpg key yet self.assertEqual( len(result.stdout['gpg']['gpg-key-id']), 0, "No gpg key expected" ) # Add first gpg key to product result = Product.update( {u'id': new_product['id'], u'gpg-key-id': first_gpg_key['id']} ) # Fetch it result = Product.info( {u'id': new_product['id'], u'organization-id': self.org['id']}) self.assertEqual( result.return_code, 0, "Product was not found") self.assertEqual( len(result.stderr), 0, "No error was expected") self.assertEqual( result.stdout['gpg']['gpg-key-id'], first_gpg_key['id'], "GPG Keys don't match") self.assertNotEqual( result.stdout['gpg']['gpg-key-id'], second_gpg_key['id'], "GPG Keys should not match") # Remove first key by updating product to use second key result = Product.update( {u'id': new_product['id'], u'gpg-key-id': second_gpg_key['id']} ) # Fetch it result = Product.info( {u'id': new_product['id'], u'organization-id': self.org['id']}) self.assertEqual( result.return_code, 0, "Product was not found") self.assertEqual( len(result.stderr), 0, "No error was expected") self.assertEqual( result.stdout['gpg']['gpg-key-id'], second_gpg_key['id'], "GPG Keys don't match" ) self.assertNotEqual( result.stdout['gpg']['gpg-key-id'], first_gpg_key['id'], "GPG Keys should not match")