def test_positive_delete_by_id(self): """Create lifecycle environment with valid name, prior to Library :id: 76989039-5389-4136-9f7c-220eb38f157b :expectedresults: Lifecycle environment is deleted :CaseImportance: Critical """ for name in valid_data_list(): with self.subTest(name): new_lce = make_lifecycle_environment({ 'name': name, 'organization-id': self.org['id'] }) LifecycleEnvironment.delete({'id': new_lce['id']}) with self.assertRaises(CLIReturnCodeError): LifecycleEnvironment.info({ 'id': new_lce['id'], 'organization-id': self.org['id'] })
def test_positive_add_and_remove_lce(module_org): """Remove a lifecycle environment from organization :id: bfa9198e-6078-4f10-b79a-3d7f51b835fd :expectedresults: Lifecycle environment is handled as expected :steps: 1. create and add lce to org 2. remove lce from org :CaseLevel: Integration """ # Create a lifecycle environment. lc_env_name = make_lifecycle_environment({'organization-id': module_org.id})['name'] lc_env_attrs = {'name': lc_env_name, 'organization-id': module_org.id} # Read back information about the lifecycle environment. Verify the # sanity of that information. response = LifecycleEnvironment.list(lc_env_attrs) assert response[0]['name'] == lc_env_name # Delete it. LifecycleEnvironment.delete(lc_env_attrs) # We should get a zero-length response when searching for the LC env. response = LifecycleEnvironment.list(lc_env_attrs) assert len(response) == 0
def test_positive_remove_lce(self): """Remove a lifecycle environment from organization @id: bfa9198e-6078-4f10-b79a-3d7f51b835fd @Assert: Lifecycle environment is removed from the org @CaseLevel: Integration """ # Create a lifecycle environment. org_id = make_org()['id'] lc_env_name = make_lifecycle_environment( {'organization-id': org_id})['name'] lc_env_attrs = { 'name': lc_env_name, 'organization-id': org_id, } # Read back information about the lifecycle environment. Verify the # sanity of that information. response = LifecycleEnvironment.list(lc_env_attrs) self.assertEqual(response[0]['name'], lc_env_name) # Delete it. LifecycleEnvironment.delete(lc_env_attrs) # We should get a zero-length response when searching for the LC env. response = LifecycleEnvironment.list(lc_env_attrs) self.assertEqual(len(response), 0)
def test_positive_delete_by_id(self): """Create lifecycle environment with valid name, prior to Library @Feature: Lifecycle Environment @Assert: Lifecycle environment is deleted """ for name in valid_data_list(): with self.subTest(name): new_lce = make_lifecycle_environment({ 'name': name, 'organization-id': self.org['id'], }) LifecycleEnvironment.delete({'id': new_lce['id']}) with self.assertRaises(CLIReturnCodeError): LifecycleEnvironment.info({ 'id': new_lce['id'], 'organization-id': self.org['id'], })
def test_positive_lce_crud(module_org): """CRUD test case for lifecycle environment for name, description, label, registry name pattern, and unauthenticated pull :id: 6b0fbf4f-528c-4983-bc3f-e81ccb7438fd :expectedresults: Lifecycle environment is created, read, updated, and deleted successfull :CaseImportance: High """ name = gen_string('alpha') new_name = gen_string('alpha') desc = gen_string('alpha') new_desc = gen_string('alpha') label = gen_string('alpha') org_name = module_org.name registry_name_pattern = ( "{}-<%= organization.label %>/<%= repository.docker_upstream_name %>" ).format(gen_string('alpha', 5)) # create lce = make_lifecycle_environment({ 'organization': org_name, 'organization-id': module_org.id, 'name': name, 'label': label, 'description': desc, }) assert lce['prior-lifecycle-environment'] == ENVIRONMENT assert lce['name'] == name assert lce['description'] == desc assert lce['label'] == label assert lce['organization'] == org_name # update LifecycleEnvironment.update({ 'id': lce['id'], 'new-name': new_name, 'description': new_desc, 'registry-unauthenticated-pull': 'true', 'registry-name-pattern': registry_name_pattern, }) lce = LifecycleEnvironment.info({ 'id': lce['id'], 'organization-id': module_org.id }) assert lce['name'] == new_name assert lce['registry-name-pattern'] == registry_name_pattern assert lce['unauthenticated-pull'] == 'true' # delete LifecycleEnvironment.delete({'id': lce['id']}) with pytest.raises(CLIReturnCodeError): LifecycleEnvironment.info({ 'id': lce['id'], 'organization-id': module_org.id })
def test_positive_delete_by_id(self): """Create lifecycle environment with valid name, prior to Library @id: 76989039-5389-4136-9f7c-220eb38f157b @Assert: Lifecycle environment is deleted """ for name in valid_data_list(): with self.subTest(name): new_lce = make_lifecycle_environment({"name": name, "organization-id": self.org["id"]}) LifecycleEnvironment.delete({"id": new_lce["id"]}) with self.assertRaises(CLIReturnCodeError): LifecycleEnvironment.info({"id": new_lce["id"], "organization-id": self.org["id"]})
def test_positive_delete_1(self, test_data): """ @Test: Create lifecycle environment with valid name, prior to Library @Feature: Lifecycle Environment @Assert: Lifecycle environment is deleted """ payload = {"organization-id": self.org["label"], "name": test_data["name"]} new_obj = make_lifecycle_environment(payload) self.assertIsNotNone(new_obj, "Could not create lifecycle environment.") # Can we find the new object result = LifecycleEnvironment.info({"organization-id": self.org["label"], "id": new_obj["id"]}) self.assertEqual(result.return_code, 0, "Could find the lifecycle environment") self.assertEqual(len(result.stderr), 0, "There should not be an error here.") self.assertGreater(len(result.stdout), 0, "No output was returned") self.assertEqual( new_obj["name"], result.stdout["name"], "Could not find lifecycle environment '%s'" % new_obj["name"] ) # Delete the lifecycle environment result = LifecycleEnvironment.delete({"id": new_obj["id"]}) self.assertEqual(result.return_code, 0, "Could find the lifecycle environment") self.assertEqual(len(result.stderr), 0, "There should not be an error here.") # Can we find the object result = LifecycleEnvironment.info({"organization-id": self.org["label"], "id": new_obj["id"]}) self.assertGreater(result.return_code, 0, "Should not find the lifecycle environment") self.assertGreater(len(result.stderr), 0, "There should be an error here")
def test_positive_delete_1(self, test_data): """@Test: Create lifecycle environment with valid name, prior to Library @Feature: Lifecycle Environment @Assert: Lifecycle environment is deleted """ new_obj = make_lifecycle_environment({ 'organization-id': self.org['id'], 'name': test_data['name'], }) # Delete the lifecycle environment result = LifecycleEnvironment.delete({'id': new_obj['id']}) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) # Can we find the object result = LifecycleEnvironment.info({ 'organization-id': self.org['id'], 'id': new_obj['id'], }) self.assertGreater(result.return_code, 0) self.assertGreater(len(result.stderr), 0)
def test_positive_delete_1(self, test_data): """@Test: Create lifecycle environment with valid name, prior to Library @Feature: Lifecycle Environment @Assert: Lifecycle environment is deleted """ payload = { 'organization-id': self.org['id'], 'name': test_data['name'], } new_obj = make_lifecycle_environment(payload) self.assertIsNotNone(new_obj, "Could not create lifecycle environment.") # Can we find the new object result = LifecycleEnvironment.info({ 'organization-id': self.org['id'], 'id': new_obj['id'], }) self.assertEqual(result.return_code, 0, "Could find the lifecycle environment") self.assertEqual(len(result.stderr), 0, "There should not be an error here.") self.assertGreater(len(result.stdout), 0, "No output was returned") self.assertEqual( new_obj['name'], result.stdout['name'], "Could not find lifecycle environment \'%s\'" % new_obj['name']) # Delete the lifecycle environment result = LifecycleEnvironment.delete({'id': new_obj['id']}) self.assertEqual(result.return_code, 0, "Could find the lifecycle environment") self.assertEqual(len(result.stderr), 0, "There should not be an error here.") # Can we find the object result = LifecycleEnvironment.info({ 'organization-id': self.org['id'], 'id': new_obj['id'], }) self.assertGreater(result.return_code, 0, "Should not find the lifecycle environment") self.assertGreater(len(result.stderr), 0, "There should be an error here")
def test_positive_delete_by_id(self): """Create lifecycle environment with valid name, prior to Library :id: 76989039-5389-4136-9f7c-220eb38f157b :expectedresults: Lifecycle environment is deleted :CaseImportance: Critical """ for name in valid_data_list(): with self.subTest(name): new_lce = make_lifecycle_environment({ 'name': name, 'organization-id': self.org['id'], }) LifecycleEnvironment.delete({'id': new_lce['id']}) with self.assertRaises(CLIReturnCodeError): LifecycleEnvironment.info({ 'id': new_lce['id'], 'organization-id': self.org['id'], })
def test_positive_remove_lce(self): """@Test: Add a lifecycle environment and then remove it @Feature: Organization @Assert: Lifecycle environment is removed from the org """ # Create a lifecycle environment. org_id = make_org()['id'] lc_env_name = make_lifecycle_environment( {'organization-id': org_id})['name'] lc_env_attrs = { 'name': lc_env_name, 'organization-id': org_id, } # Read back information about the lifecycle environment. Verify the # sanity of that information. response = LifecycleEnvironment.list(lc_env_attrs) self.assertEqual(response[0]['name'], lc_env_name) # Delete it. LifecycleEnvironment.delete(lc_env_attrs) # We should get a zero-length response when searcing for the LC env. response = LifecycleEnvironment.list(lc_env_attrs) self.assertEqual(len(response), 0)