def test_positive_delete_by_name(self): """Check if host collection can be created and deleted by name :id: a841a9f8-4285-40e5-9670-3f379dfd9a1e :customerscenario: true :expectedresults: Host collection is created and then deleted :BZ: 1328925 :CaseImportance: Critical """ for name in valid_data_list(): with self.subTest(name): new_host_col = make_host_collection({ 'name': name, 'organization-id': self.organization['id'], }) HostCollection.delete({ 'name': new_host_col['name'], 'organization-id': self.organization['id'], }) with self.assertRaises(CLIReturnCodeError): HostCollection.info({'id': new_host_col['id']})
def test_positive_delete_by_id(self): """Check if host collection can be created and deleted @Feature: Host Collection @Assert: Host collection is created and then deleted """ for name in valid_data_list(): with self.subTest(name): new_host_col = self._new_host_collection({"name": name}) HostCollection.delete({"id": new_host_col["id"], "organization-id": self.org["id"]}) with self.assertRaises(CLIReturnCodeError): HostCollection.info({"id": new_host_col["id"]})
def test_positive_delete_1(self, test_data): """@Test: Check if host collection can be created and deleted @Feature: Host Collection @Assert: Host collection is created and then deleted """ new_host_col = self._new_host_collection({'name': test_data['name']}) # Assert that name matches data passed self.assertEqual(new_host_col['name'], test_data['name']) # Delete it result = HostCollection.delete( {'id': new_host_col['id'], 'organization-id': self.org['id']}) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) # Fetch it result = HostCollection.info( { 'id': new_host_col['id'], } ) self.assertNotEqual(result.return_code, 0) self.assertGreater(len(result.stderr), 0)
def test_positive_delete_1(self, test_data): """@Test: Check if host collection can be created and deleted @Feature: Host Collection @Assert: Host collection is created and then deleted """ new_host_col = self._new_host_collection({'name': test_data['name']}) # Assert that name matches data passed self.assertEqual(new_host_col['name'], test_data['name'], "Names don't match") # Delete it result = HostCollection.delete({ 'id': new_host_col['id'], 'organization-id': self.org['id'] }) self.assertEqual(result.return_code, 0, "Host collection was not deleted") self.assertEqual(len(result.stderr), 0, "No error was expected") # Fetch it result = HostCollection.info({ 'id': new_host_col['id'], }) self.assertNotEqual(result.return_code, 0, "Host collection should not be found") self.assertGreater(len(result.stderr), 0, "Expected an error here")
def test_positive_delete_by_id(self): """Check if host collection can be created and deleted @Feature: Host Collection @Assert: Host collection is created and then deleted """ for name in valid_data_list(): with self.subTest(name): new_host_col = self._new_host_collection({'name': name}) HostCollection.delete({ 'id': new_host_col['id'], 'organization-id': self.org['id'], }) with self.assertRaises(CLIReturnCodeError): HostCollection.info({'id': new_host_col['id']})
def test_positive_delete_1(self): """@Test: Check if host collection can be created and deleted @Feature: Host Collection @Assert: Host collection is created and then deleted """ for name in valid_data_list(): with self.subTest(name): new_host_col = self._new_host_collection({'name': name}) HostCollection.delete({ 'id': new_host_col['id'], 'organization-id': self.org['id'], }) with self.assertRaises(CLIReturnCodeError): HostCollection.info({'id': new_host_col['id']})
def test_positive_delete_by_id(self): """Check if host collection can be created and deleted @id: ef54a26e-a18f-4f29-8ef4-a7124785dbae @Assert: Host collection is created and then deleted @BZ: 1328925 """ for name in valid_data_list(): with self.subTest(name): new_host_col = self._new_host_collection({'name': name}) HostCollection.delete({ 'id': new_host_col['id'], 'organization-id': self.org['id'], }) with self.assertRaises(CLIReturnCodeError): HostCollection.info({'id': new_host_col['id']})
def test_positive_delete_by_id(self): """Check if host collection can be created and deleted by id :id: ef54a26e-a18f-4f29-8ef4-a7124785dbae :expectedresults: Host collection is created and then deleted :BZ: 1328925 :CaseImportance: Critical """ for name in valid_data_list(): with self.subTest(name): new_host_col = make_host_collection({ 'name': name, 'organization-id': self.organization['id'], }) HostCollection.delete({ 'id': new_host_col['id'], }) with self.assertRaises(CLIReturnCodeError): HostCollection.info({'id': new_host_col['id']})
def test_positive_end_to_end(module_org): """Check if host collection can be created with name and description, content host can be added and removed, host collection can be listed, updated and deleted :id: 2d3b718e-6f57-4c83-aedb-15604cc8a4bd :expectedresults: Host collection is created and has expected name and description, content-host is added and removed, host collection is updated and deleted. :CaseImportance: Critical """ name = list(valid_data_list().values())[0] desc = list(valid_data_list().values())[0] new_host_col = make_host_collection( {'description': desc, 'name': name, 'organization-id': module_org.id} ) assert new_host_col['name'] == name assert new_host_col['description'] == desc # add host new_system = _make_fake_host_helper(module_org) no_of_content_host = new_host_col['total-hosts'] HostCollection.add_host({'host-ids': new_system['id'], 'id': new_host_col['id']}) result = HostCollection.info({'id': new_host_col['id']}) assert result['total-hosts'] > no_of_content_host # list hosts result = HostCollection.hosts({'name': name, 'organization-id': module_org.id}) assert new_system['name'].lower() == result[0]['name'] # List all host collections within organization result = HostCollection.list({'organization': module_org.name}) assert len(result) >= 1 # Filter list by name result = HostCollection.list({'name': name, 'organization-id': module_org.id}) assert len(result) == 1 assert result[0]['id'] == new_host_col['id'] # Filter list by associated host name result = HostCollection.list({'organization': module_org.name, 'host': new_system['name']}) assert len(result) == 1 assert result[0]['name'] == new_host_col['name'] # remove host no_of_content_host = HostCollection.info({'id': new_host_col['id']})['total-hosts'] HostCollection.remove_host({'host-ids': new_system['id'], 'id': new_host_col['id']}) result = HostCollection.info({'id': new_host_col['id']}) assert no_of_content_host > result['total-hosts'] # update new_name = list(valid_data_list().values())[0] new_desc = list(valid_data_list().values())[0] HostCollection.update( {'description': new_desc, 'id': new_host_col['id'], 'new-name': new_name} ) result = HostCollection.info({'id': new_host_col['id']}) assert result['name'] == new_name assert result['description'] == new_desc # delete HostCollection.delete({'id': new_host_col['id']}) with pytest.raises(CLIReturnCodeError): HostCollection.info({'id': new_host_col['id']})
def test_positive_end_to_end(self): """Check if host collection can be created with name and description, content host can be added and removed, host collection can be listed, updated and deleted :id: 2d3b718e-6f57-4c83-aedb-15604cc8a4bd :expectedresults: Host collection is created and has expected name and description, content-host is added and removed, host collection is updated and deleted. :CaseImportance: Critical """ name = valid_data_list()[0] desc = valid_data_list()[0] new_host_col = make_host_collection({ 'description': desc, 'name': name, 'organization-id': self.organization['id'] }) self.assertEqual(new_host_col['name'], name) self.assertEqual(new_host_col['description'], desc) # add host new_system = self._make_fake_host_helper() no_of_content_host = new_host_col['total-hosts'] HostCollection.add_host({ 'host-ids': new_system['id'], 'id': new_host_col['id'] }) result = HostCollection.info({'id': new_host_col['id']}) self.assertGreater(result['total-hosts'], no_of_content_host) # list hosts result = HostCollection.hosts({ 'name': name, 'organization-id': self.organization['id'] }) self.assertEqual(new_system['name'].lower(), result[0]['name']) # List all host collections within organization result = HostCollection.list( {'organization': self.organization['name']}) self.assertGreaterEqual(len(result), 2) # Filter list by name result = HostCollection.list({ 'name': name, 'organization-id': self.organization['id'] }) self.assertEqual(len(result), 1) self.assertEqual(result[0]['id'], new_host_col['id']) # Filter list by associated host name result = HostCollection.list({ 'organization': self.organization['name'], 'host': new_system['name'] }) self.assertEqual(len(result), 1) self.assertEqual(result[0]['name'], new_host_col['name']) # remove host no_of_content_host = HostCollection.info({'id': new_host_col['id'] })['total-hosts'] HostCollection.remove_host({ 'host-ids': new_system['id'], 'id': new_host_col['id'] }) result = HostCollection.info({'id': new_host_col['id']}) self.assertGreater(no_of_content_host, result['total-hosts']) # update new_name = valid_data_list()[0] new_desc = valid_data_list()[0] HostCollection.update({ 'description': new_desc, 'id': new_host_col['id'], 'new-name': new_name }) result = HostCollection.info({'id': new_host_col['id']}) self.assertEqual(result['name'], new_name) self.assertEqual(result['description'], new_desc) # delete HostCollection.delete({'id': new_host_col['id']}) with self.assertRaises(CLIReturnCodeError): HostCollection.info({'id': new_host_col['id']})