def test_update_model(self): """@Test: Check if Model can be updated @Feature: Model - Positive Update @Assert: Model is updated """ name = gen_string("alpha", 10) try: model = self.factory({'name': name}) except CLIFactoryError as err: self.fail(err) self.assertEqual(name, model['name']) new_name = gen_string("alpha", 10) result = Model().update({'name': model['name'], 'new-name': new_name}) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0, "There should not be an error here") result = Model.info({'name': new_name}) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) self.assertEqual(result.stdout['name'], new_name, "Model name was not updated")
def test_negative_create_with_name(self): """Don't create an Model with invalid data. @id: b2eade66-b612-47e7-bfcc-6e363023f498 @Assert: Model is not created. """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(CLIReturnCodeError): Model.create({'name': name})
def test_negative_create_with_name(self): """Don't create an Model with invalid data. @Feature: Model @Assert: Model is not created. """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(CLIReturnCodeError): Model.create({'name': name})
def test_negative_delete(self): """@test: Create Model then delete it by wrong ID @feature: Model @assert: Model is not deleted """ for entity_id in invalid_id_list(): with self.subTest(entity_id): with self.assertRaises(CLIReturnCodeError): Model.delete({'id': entity_id})
def test_negative_create(self): """@Test: Don't create an Model with invalid data. @Feature: Model @Assert: Model is not created. """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(CLIReturnCodeError): Model.create({'name': name})
def test_negative_delete_by_id(self): """Create Model then delete it by wrong ID @id: f8b0d428-1b3d-4fc9-9ca1-1eb30c8ac20a @assert: Model is not deleted """ for entity_id in invalid_id_list(): with self.subTest(entity_id): with self.assertRaises(CLIReturnCodeError): Model.delete({'id': entity_id})
def test_negative_delete_by_id(self): """Create Model then delete it by wrong ID @feature: Model @assert: Model is not deleted """ for entity_id in invalid_id_list(): with self.subTest(entity_id): with self.assertRaises(CLIReturnCodeError): Model.delete({'id': entity_id})
def test_negative_create_with_name(self): """Don't create an Model with invalid data. :id: b2eade66-b612-47e7-bfcc-6e363023f498 :expectedresults: Model is not created. :CaseImportance: Critical """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(CLIReturnCodeError): Model.create({'name': name})
def test_negative_delete_by_id(self, entity_id): """Delete model by wrong ID :id: f8b0d428-1b3d-4fc9-9ca1-1eb30c8ac20a :parametrized: yes :expectedresults: Model is not deleted :CaseImportance: High """ with pytest.raises(CLIReturnCodeError): Model.delete({'id': entity_id})
def test_negative_delete_by_id(self): """Create Model then delete it by wrong ID :id: f8b0d428-1b3d-4fc9-9ca1-1eb30c8ac20a :expectedresults: Model is not deleted :CaseImportance: Critical """ for entity_id in invalid_id_list(): with self.subTest(entity_id): with self.assertRaises(CLIReturnCodeError): Model.delete({'id': entity_id})
def test_negative_create_with_name(self, name): """Don't create an Model with invalid data. :id: b2eade66-b612-47e7-bfcc-6e363023f498 :parametrized: yes :expectedresults: Model is not created. :CaseImportance: High """ with pytest.raises(CLIReturnCodeError): Model.create({'name': name})
def test_positive_delete(self): """@test: Create Model with valid values then delete it by ID @feature: Model @assert: Model is deleted """ for name in valid_data_list(): with self.subTest(name): model = make_model({'name': name}) Model.delete({'id': model['id']}) with self.assertRaises(CLIReturnCodeError): Model.info({'id': model['id']})
def test_positive_delete_by_id(self): """Create Model with valid values then delete it by ID @id: 39f02cec-ac4c-4801-9a4a-11160247213f @assert: Model is deleted """ for name in valid_data_list(): with self.subTest(name): model = make_model({'name': name}) Model.delete({'id': model['id']}) with self.assertRaises(CLIReturnCodeError): Model.info({'id': model['id']})
def test_positive_update_name(self): """Successfully update an Model. :id: 66eb6cf2-9ec5-4947-97e0-b612780c5cc3 :expectedresults: Model is updated. :CaseImportance: Medium """ model = make_model() for new_name in valid_data_list().values(): with self.subTest(new_name): Model.update({'id': model['id'], 'new-name': new_name}) model = Model.info({'id': model['id']}) self.assertEqual(model['name'], new_name)
def test_negative_update_name(self, class_model, new_name): """Fail to update shared model name :id: 98020a4a-1789-4df3-929c-6c132b57f5a1 :parametrized: yes :expectedresults: Model name is not updated :CaseImportance: Medium """ with pytest.raises(CLIReturnCodeError): Model.update({'id': class_model['id'], 'new-name': new_name}) result = Model.info({'id': class_model['id']}) assert class_model['name'] == result['name']
def test_positive_update_name(self): """@Test: Successfully update an Model. @Feature: Model @Assert: Model is updated. """ model = make_model() for new_name in valid_data_list(): with self.subTest(new_name): Model.update({ 'id': model['id'], 'new-name': new_name, }) model = Model.info({'id': model['id']}) self.assertEqual(model['name'], new_name)
def test_positive_update_name(self): """Successfully update an Model. @Feature: Model @Assert: Model is updated. """ model = make_model() for new_name in valid_data_list(): with self.subTest(new_name): Model.update({ 'id': model['id'], 'new-name': new_name, }) model = Model.info({'id': model['id']}) self.assertEqual(model['name'], new_name)
def test_update_model(self): """@Test: Check if Model can be updated @Feature: Model - Positive Update @Assert: Model is updated """ name = gen_string("alpha") try: model = self.factory({'name': name}) except CLIFactoryError as err: self.fail(err) self.assertEqual(name, model['name']) new_name = gen_string("alpha") result = Model().update({'name': model['name'], 'new-name': new_name}) self.assertEqual(result.return_code, 0) self.assertEqual( len(result.stderr), 0, "There should not be an error here") result = Model.info({'name': new_name}) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) self.assertEqual( result.stdout['name'], new_name, "Model name was not updated" )
def test_positive_update_name(self): """Successfully update an Model. @id: 66eb6cf2-9ec5-4947-97e0-b612780c5cc3 @Assert: Model is updated. """ model = make_model() for new_name in valid_data_list(): with self.subTest(new_name): Model.update({ 'id': model['id'], 'new-name': new_name, }) model = Model.info({'id': model['id']}) self.assertEqual(model['name'], new_name)
def test_negative_update_name(self): """Create Model then fail to update its name :id: 98020a4a-1789-4df3-929c-6c132b57f5a1 :expectedresults: Model name is not updated :CaseImportance: Medium """ model = make_model() for new_name in invalid_values_list(): with self.subTest(new_name): with self.assertRaises(CLIReturnCodeError): Model.update({'id': model['id'], 'new-name': new_name}) result = Model.info({'id': model['id']}) self.assertEqual(model['name'], result['name'])
def test_negative_update(self): """@test: Create Model then fail to update its name @feature: Model @assert: Model name is not updated """ model = make_model() for new_name in invalid_values_list(): with self.subTest(new_name): with self.assertRaises(CLIReturnCodeError): Model.update({ 'id': model['id'], 'new-name': new_name, }) result = Model.info({'id': model['id']}) self.assertEqual(model['name'], result['name'])
def test_negative_update_name(self): """Create Model then fail to update its name @feature: Model @assert: Model name is not updated """ model = make_model() for new_name in invalid_values_list(): with self.subTest(new_name): with self.assertRaises(CLIReturnCodeError): Model.update({ 'id': model['id'], 'new-name': new_name, }) result = Model.info({'id': model['id']}) self.assertEqual(model['name'], result['name'])
def test_negative_update_name(self): """Create Model then fail to update its name @id: 98020a4a-1789-4df3-929c-6c132b57f5a1 @assert: Model name is not updated """ model = make_model() for new_name in invalid_values_list(): with self.subTest(new_name): with self.assertRaises(CLIReturnCodeError): Model.update({ 'id': model['id'], 'new-name': new_name, }) result = Model.info({'id': model['id']}) self.assertEqual(model['name'], result['name'])
def test_create_model_1(self): """ @Feature: Model - Positive Create @Test: Check if Model can be created @Assert: Model is created """ result = self.factory() model = Model().info({'name': result['name']}) self.assertEqual(result['name'], model.stdout['name'])
def test_positive_update_name(self): """Successfully update an Model. :id: 66eb6cf2-9ec5-4947-97e0-b612780c5cc3 :expectedresults: Model is updated. :CaseImportance: Critical """ model = make_model() for new_name in valid_data_list(): with self.subTest(new_name): Model.update({ 'id': model['id'], 'new-name': new_name, }) model = Model.info({'id': model['id']}) self.assertEqual(model['name'], new_name)
def test_create_model_2(self): """ @Feature: Model - Positive Create @Test: Check if Model can be created with specific vendor class @Assert: Model is created with specific vendor class """ result = self.factory({'vendor-class': generate_string("alpha", 10)}) # Check that Model was created with proper values model = Model().info({'name': result['name']}) self.assertEqual(result['vendor-class'], model.stdout['vendor-class'])
def test_positive_crud_with_name(self, name, new_name): """Successfully creates, updates and deletes a Model. :id: 9ca9d5ff-750a-4d60-91b2-4c4375f0e35f :parametrized: yes :expectedresults: Model is created, updated and deleted. :CaseImportance: High """ model = make_model({'name': name}) assert model['name'] == name Model.update({'id': model['id'], 'new-name': new_name}) model = Model.info({'id': model['id']}) assert model['name'] == new_name Model.delete({'id': model['id']}) with pytest.raises(CLIReturnCodeError): Model.info({'id': model['id']})