def test_positive_update_description(self): """Create lifecycle environment then update its description :id: 15b82949-3c3a-4942-b42b-db1de34cf5be :expectedresults: Lifecycle environment description is updated :CaseImportance: Critical """ new_lce = make_lifecycle_environment({ 'organization-id': self.org['id'], }) for new_desc in valid_data_list(): with self.subTest(new_desc): LifecycleEnvironment.update({ 'description': new_desc, 'id': new_lce['id'], 'organization-id': self.org['id'], }) result = LifecycleEnvironment.info({ 'id': new_lce['id'], 'organization-id': self.org['id'], }) self.assertGreater(len(result), 0) self.assertEqual(result['description'], new_desc)
def test_positive_update_unauthenticated_pull(self): """Create lifecycle environment and then update registry's unauthenticated pull :id: 8b73e0b7-30c9-4211-87a4-53dc0b0f3e21 :expectedresults: Lifecycle environment registry's unauthenticated pull is updated :CaseImportance: Critical """ lce = make_lifecycle_environment({'organization-id': self.org['id']}) LifecycleEnvironment.update({ 'registry-unauthenticated-pull': 'true', 'id': lce['id'], 'organization-id': self.org['id'], }) result = LifecycleEnvironment.info({ 'id': lce['id'], 'organization-id': self.org['id'] }) self.assertGreater(len(result), 0) self.assertEqual(result['unauthenticated-pull'], 'true')
def test_positive_update_registry_name_pattern(self): """Create lifecycle environment and then update registry name pattern :id: 131aaed7-d74f-4c9a-be7e-04226d48e64a :expectedresults: Lifecycle environment registry name pattern is updated :CaseImportance: Critical """ lce = make_lifecycle_environment({'organization-id': self.org['id']}) registry_name_pattern = ( "{}-<%= organization.label %>/<%= repository.docker_upstream_name %>" ).format(gen_string('alpha', 5)) LifecycleEnvironment.update({ 'registry-name-pattern': registry_name_pattern, 'id': lce['id'], 'organization-id': self.org['id'], }) result = LifecycleEnvironment.info({ 'id': lce['id'], 'organization-id': self.org['id'] }) self.assertGreater(len(result), 0) self.assertEqual(result['registry-name-pattern'], registry_name_pattern)
def test_positive_update_name(self): """Create lifecycle environment then update its name :id: de67a44e-6c6a-430e-927b-4fa43c7c2771 :expectedresults: Lifecycle environment name is updated :CaseImportance: Critical """ new_lce = make_lifecycle_environment( {'organization-id': self.org['id']}) for new_name in valid_data_list(): with self.subTest(new_name): LifecycleEnvironment.update({ 'id': new_lce['id'], 'new-name': new_name, 'organization-id': self.org['id'] }) result = LifecycleEnvironment.info({ 'id': new_lce['id'], 'organization-id': self.org['id'] }) self.assertGreater(len(result), 0) self.assertEqual(result['name'], new_name)
def test_positive_update_description(self): """Create lifecycle environment then update its description :id: 15b82949-3c3a-4942-b42b-db1de34cf5be :expectedresults: Lifecycle environment description is updated :CaseImportance: Critical """ new_lce = make_lifecycle_environment( {'organization-id': self.org['id']}) for new_desc in valid_data_list(): with self.subTest(new_desc): LifecycleEnvironment.update({ 'description': new_desc, 'id': new_lce['id'], 'organization-id': self.org['id'], }) result = LifecycleEnvironment.info({ 'id': new_lce['id'], 'organization-id': self.org['id'] }) self.assertGreater(len(result), 0) self.assertEqual(result['description'], new_desc)
def test_positive_update_description(self): """Create lifecycle environment then update its description @Feature: Lifecycle Environment @Assert: Lifecycle environment description is updated """ new_lce = make_lifecycle_environment({ 'organization-id': self.org['id'], }) for new_desc in valid_data_list(): with self.subTest(new_desc): LifecycleEnvironment.update({ 'description': new_desc, 'id': new_lce['id'], 'organization-id': self.org['id'], 'prior': new_lce['prior-lifecycle-environment'], }) result = LifecycleEnvironment.info({ 'id': new_lce['id'], 'organization-id': self.org['id'], }) self.assertGreater(len(result), 0) self.assertEqual(result['description'], new_desc)
def test_positive_update_name(self): """Create lifecycle environment then update its name :id: de67a44e-6c6a-430e-927b-4fa43c7c2771 :expectedresults: Lifecycle environment name is updated :CaseImportance: Critical """ new_lce = make_lifecycle_environment({ 'organization-id': self.org['id'], }) for new_name in valid_data_list(): with self.subTest(new_name): LifecycleEnvironment.update({ 'id': new_lce['id'], 'new-name': new_name, 'organization-id': self.org['id'], }) result = LifecycleEnvironment.info({ 'id': new_lce['id'], 'organization-id': self.org['id'], }) self.assertGreater(len(result), 0) self.assertEqual(result['name'], new_name)
def test_positive_update_1(self): """@Test: Create lifecycle environment then update its name @Feature: Lifecycle Environment @Assert: Lifecycle environment name is updated """ new_lce = make_lifecycle_environment({ 'organization-id': self.org['id'], }) for new_name in valid_data_list(): with self.subTest(new_name): LifecycleEnvironment.update({ 'id': new_lce['id'], 'new-name': new_name, 'organization-id': self.org['id'], 'prior': new_lce['prior-lifecycle-environment'], }) result = LifecycleEnvironment.info({ 'id': new_lce['id'], 'organization-id': self.org['id'], }) self.assertGreater(len(result), 0) self.assertEqual(result['name'], new_name)
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_update_2(self, test_data): """ @Test: Create lifecycle environment then update its description @Feature: Lifecycle Environment @Assert: Lifecycle environment description is updated """ payload = {"organization-id": self.org["label"]} new_obj = make_lifecycle_environment(payload) self.assertIsNotNone(new_obj, "Could not create lifecycle environment.") # Update its description result = LifecycleEnvironment.update( {"organization-id": self.org["label"], "id": new_obj["id"], "description": test_data["description"]} ) self.assertEqual(result.return_code, 0, "Could find the lifecycle environment") self.assertEqual(len(result.stderr), 0, "There should not be an error here.") # Fetch the 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(test_data["description"], result.stdout["description"], "Description was not updated") self.assertNotEqual( new_obj["description"], result.stdout["description"], "Description should have been updated" )
def test_positive_update_2(self, test_data): """@Test: Create lifecycle environment then update its description @Feature: Lifecycle Environment @Assert: Lifecycle environment description is updated """ new_obj = make_lifecycle_environment({ 'organization-id': self.org['id'], }) # Update its description result = LifecycleEnvironment.update({ 'description': test_data['description'], 'id': new_obj['id'], 'organization-id': self.org['id'], 'prior': new_obj['prior-lifecycle-environment'], }) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) # Fetch the object result = LifecycleEnvironment.info({ 'id': new_obj['id'], 'organization-id': self.org['id'], }) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) self.assertGreater(len(result.stdout), 0) self.assertEqual( test_data['description'], result.stdout['description']) self.assertNotEqual( new_obj['description'], result.stdout['description'])
def test_positive_update_1(self, test_data): """@Test: Create lifecycle environment then update its name @Feature: Lifecycle Environment @Assert: Lifecycle environment name is updated """ payload = { 'organization-id': self.org['id'], } new_obj = make_lifecycle_environment(payload) # Update its name result = LifecycleEnvironment.update({ 'organization-id': self.org['id'], 'id': new_obj['id'], 'new-name': test_data['name'], }) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) # Fetch the object result = LifecycleEnvironment.info({ 'organization-id': self.org['id'], 'id': new_obj['id'], }) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) self.assertGreater(len(result.stdout), 0) self.assertEqual(test_data['name'], result.stdout['name']) self.assertNotEqual(new_obj['name'], result.stdout['name'])
def test_positive_update_description(self): """Create lifecycle environment then update its description @id: 15b82949-3c3a-4942-b42b-db1de34cf5be @Assert: Lifecycle environment description is updated """ new_lce = make_lifecycle_environment({"organization-id": self.org["id"]}) for new_desc in valid_data_list(): with self.subTest(new_desc): LifecycleEnvironment.update( {"description": new_desc, "id": new_lce["id"], "organization-id": self.org["id"]} ) result = LifecycleEnvironment.info({"id": new_lce["id"], "organization-id": self.org["id"]}) self.assertGreater(len(result), 0) self.assertEqual(result["description"], new_desc)
def test_positive_update_name(self): """Create lifecycle environment then update its name @id: de67a44e-6c6a-430e-927b-4fa43c7c2771 @Assert: Lifecycle environment name is updated """ new_lce = make_lifecycle_environment({"organization-id": self.org["id"]}) for new_name in valid_data_list(): with self.subTest(new_name): LifecycleEnvironment.update( {"id": new_lce["id"], "new-name": new_name, "organization-id": self.org["id"]} ) result = LifecycleEnvironment.info({"id": new_lce["id"], "organization-id": self.org["id"]}) self.assertGreater(len(result), 0) self.assertEqual(result["name"], new_name)
def test_positive_update_1(self, test_data): """@Test: Create lifecycle environment then update its name @Feature: Lifecycle Environment @Assert: Lifecycle environment name is updated @BZ: 1095937, 1099655 """ payload = { 'organization-id': self.org['id'], } new_obj = make_lifecycle_environment(payload) self.assertIsNotNone( new_obj, "Could not create lifecycle environment.") # Update its name result = LifecycleEnvironment.update( { 'organization-id': self.org['id'], 'id': new_obj['id'], 'new-name': test_data['name'], } ) self.assertEqual( result.return_code, 0, "Could find the lifecycle environment" ) self.assertEqual( len(result.stderr), 0, "There should not be an error here.") # Fetch the 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( test_data['name'], result.stdout['name'], "Name was not updated" ) self.assertNotEqual( new_obj['name'], result.stdout['name'], "Name should have been updated" )
def test_positive_update_2(self, test_data): """@Test: Create lifecycle environment then update its description @Feature: Lifecycle Environment @Assert: Lifecycle environment description is updated """ payload = { 'organization-id': self.org['id'], } new_obj = make_lifecycle_environment(payload) self.assertIsNotNone(new_obj, "Could not create lifecycle environment.") # Update its description result = LifecycleEnvironment.update({ 'organization-id': self.org['id'], 'id': new_obj['id'], 'description': test_data['description'], }) self.assertEqual(result.return_code, 0, "Could find the lifecycle environment") self.assertEqual(len(result.stderr), 0, "There should not be an error here.") # Fetch the 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(test_data['description'], result.stdout['description'], "Description was not updated") self.assertNotEqual(new_obj['description'], result.stdout['description'], "Description should have been updated")