def test_positive_remove_host_collection_by_id(self): """@Test: Test that hosts associated to Activation Keys can be removed using id of that host collection @Feature: Activation key - Host @Steps: 1. Create Activation key 2. Create host collection 3. Associate host collection to Activation key 4. Remove host collection associated to Activation key using id of that collection @Assert: Host collection successfully removed from activation key """ activation_key = self._make_activation_key() new_host_col = make_host_collection({ u'name': gen_string('alpha'), u'organization-id': self.org['id'], }) ActivationKey.add_host_collection({ u'host-collection-id': new_host_col['id'], u'name': activation_key['name'], u'organization': self.org['name'], }) activation_key = ActivationKey.info({u'id': activation_key['id']}) self.assertEqual(len(activation_key['host-collections']), 1) ActivationKey.remove_host_collection({ u'host-collection-id': new_host_col['id'], u'name': activation_key['name'], u'organization': self.org['name'], }) activation_key = ActivationKey.info({u'id': activation_key['id']}) self.assertEqual(len(activation_key['host-collections']), 0)
def test_positive_remove_host_collection_by_id(self): """Test that hosts associated to Activation Keys can be removed using id of that host collection @Feature: Activation key - Host @Steps: 1. Create Activation key 2. Create host collection 3. Associate host collection to Activation key 4. Remove host collection associated to Activation key using id of that collection @Assert: Host collection successfully removed from activation key """ activation_key = self._make_activation_key() new_host_col = make_host_collection({ u'name': gen_string('alpha'), u'organization-id': self.org['id'], }) ActivationKey.add_host_collection({ u'host-collection-id': new_host_col['id'], u'name': activation_key['name'], u'organization': self.org['name'], }) activation_key = ActivationKey.info({u'id': activation_key['id']}) self.assertEqual(len(activation_key['host-collections']), 1) ActivationKey.remove_host_collection({ u'host-collection-id': new_host_col['id'], u'name': activation_key['name'], u'organization': self.org['name'], }) activation_key = ActivationKey.info({u'id': activation_key['id']}) self.assertEqual(len(activation_key['host-collections']), 0)
def test_positive_remove_host_collection_by_name(self): """Test that hosts associated to Activation Keys can be removed using name of that host collection :id: 1a559a82-db5f-48b0-beeb-2fa02aed7ef9 :Steps: 1. Create Activation key 2. Create host collection 3. Associate host collection to Activation key 4. Remove the host collection associated to Activation key using name of that collection :expectedresults: Host collection successfully removed from activation key :CaseLevel: Integration """ for host_col in valid_data_list(): with self.subTest(host_col): activation_key = self._make_activation_key() new_host_col = make_host_collection({ u'name': host_col, u'organization-id': self.org['id'], }) # Assert that name matches data passed self.assertEqual(new_host_col['name'], host_col) ActivationKey.add_host_collection({ u'host-collection': new_host_col['name'], u'name': activation_key['name'], u'organization-id': self.org['id'], }) activation_key = ActivationKey.info({ 'id': activation_key['id'], }) self.assertEqual(len(activation_key['host-collections']), 1) self.assertEqual( activation_key['host-collections'][0]['name'], host_col, ) ActivationKey.remove_host_collection({ u'host-collection': new_host_col['name'], u'name': activation_key['name'], u'organization-id': self.org['id'], }) activation_key = ActivationKey.info({ u'id': activation_key['id'], }) self.assertEqual(len(activation_key['host-collections']), 0)
def test_remove_hc_by_name(self): """@Test: Test that hosts associated to Activation Keys can be removed using name of that host collection @Feature: Activation key - Host @Steps: 1. Create Activation key 2. Create host collection 3. Associate host collection to Activation key 4. Remove the host collection associated to Activation key using name of that collection @Assert: Host collection successfully removed from activation key """ for host_col in valid_data_list(): with self.subTest(host_col): activation_key = self._make_activation_key() new_host_col = make_host_collection({ u'name': host_col, u'organization-id': self.org['id'], }) # Assert that name matches data passed self.assertEqual(new_host_col['name'], host_col) ActivationKey.add_host_collection({ u'host-collection': new_host_col['name'], u'name': activation_key['name'], u'organization-id': self.org['id'], }) activation_key = ActivationKey.info({ 'id': activation_key['id'], }) self.assertEqual(len(activation_key['host-collections']), 1) self.assertEqual( activation_key['host-collections'][0]['name'], host_col, ) ActivationKey.remove_host_collection({ u'host-collection': new_host_col['name'], u'name': activation_key['name'], u'organization-id': self.org['id'], }) activation_key = ActivationKey.info({ u'id': activation_key['id'], }) self.assertEqual(len(activation_key['host-collections']), 0)
def test_positive_remove_host_collection_by_name(self): """Test that hosts associated to Activation Keys can be removed using name of that host collection @Feature: Activation key - Host @Steps: 1. Create Activation key 2. Create host collection 3. Associate host collection to Activation key 4. Remove the host collection associated to Activation key using name of that collection @Assert: Host collection successfully removed from activation key """ for host_col in valid_data_list(): with self.subTest(host_col): activation_key = self._make_activation_key() new_host_col = make_host_collection({ u'name': host_col, u'organization-id': self.org['id'], }) # Assert that name matches data passed self.assertEqual(new_host_col['name'], host_col) ActivationKey.add_host_collection({ u'host-collection': new_host_col['name'], u'name': activation_key['name'], u'organization-id': self.org['id'], }) activation_key = ActivationKey.info({ 'id': activation_key['id'], }) self.assertEqual(len(activation_key['host-collections']), 1) self.assertEqual( activation_key['host-collections'][0]['name'], host_col, ) ActivationKey.remove_host_collection({ u'host-collection': new_host_col['name'], u'name': activation_key['name'], u'organization-id': self.org['id'], }) activation_key = ActivationKey.info({ u'id': activation_key['id'], }) self.assertEqual(len(activation_key['host-collections']), 0)
def test_positive_remove_host_collection_by_id(self): """Test that hosts associated to Activation Keys can be removed using id of that host collection :id: 20f8ecca-1756-4900-b966-f0144b6bd0aa :Steps: 1. Create Activation key 2. Create host collection 3. Associate host collection to Activation key 4. Remove host collection associated to Activation key using id of that collection :expectedresults: Host collection successfully removed from activation key :CaseLevel: Integration """ activation_key = self._make_activation_key() new_host_col = make_host_collection({ u'name': gen_string('alpha'), u'organization-id': self.org['id'], }) ActivationKey.add_host_collection({ u'host-collection-id': new_host_col['id'], u'name': activation_key['name'], u'organization': self.org['name'], }) activation_key = ActivationKey.info({u'id': activation_key['id']}) self.assertEqual(len(activation_key['host-collections']), 1) ActivationKey.remove_host_collection({ u'host-collection-id': new_host_col['id'], u'name': activation_key['name'], u'organization': self.org['name'], }) activation_key = ActivationKey.info({u'id': activation_key['id']}) self.assertEqual(len(activation_key['host-collections']), 0)
def test_positive_remove_host_collection_by_name(self): """Test that hosts associated to Activation Keys can be removed using name of that host collection @Feature: Activation key - Host @Steps: 1. Create Activation key 2. Create host collection 3. Associate host collection to Activation key 4. Remove the host collection associated to Activation key using name of that collection @Assert: Host collection successfully removed from activation key """ for host_col in valid_data_list(): with self.subTest(host_col): activation_key = self._make_activation_key() new_host_col = make_host_collection({u"name": host_col, u"organization-id": self.org["id"]}) # Assert that name matches data passed self.assertEqual(new_host_col["name"], host_col) ActivationKey.add_host_collection( { u"host-collection": new_host_col["name"], u"name": activation_key["name"], u"organization-id": self.org["id"], } ) activation_key = ActivationKey.info({"id": activation_key["id"]}) self.assertEqual(len(activation_key["host-collections"]), 1) self.assertEqual(activation_key["host-collections"][0]["name"], host_col) ActivationKey.remove_host_collection( { u"host-collection": new_host_col["name"], u"name": activation_key["name"], u"organization-id": self.org["id"], } ) activation_key = ActivationKey.info({u"id": activation_key["id"]}) self.assertEqual(len(activation_key["host-collections"]), 0)
def test_positive_remove_host_collection_by_id(self): """Test that hosts associated to Activation Keys can be removed using id of that host collection @Feature: Activation key - Host @Steps: 1. Create Activation key 2. Create host collection 3. Associate host collection to Activation key 4. Remove host collection associated to Activation key using id of that collection @Assert: Host collection successfully removed from activation key """ activation_key = self._make_activation_key() new_host_col = make_host_collection({u"name": gen_string("alpha"), u"organization-id": self.org["id"]}) ActivationKey.add_host_collection( { u"host-collection-id": new_host_col["id"], u"name": activation_key["name"], u"organization": self.org["name"], } ) activation_key = ActivationKey.info({u"id": activation_key["id"]}) self.assertEqual(len(activation_key["host-collections"]), 1) ActivationKey.remove_host_collection( { u"host-collection-id": new_host_col["id"], u"name": activation_key["name"], u"organization": self.org["name"], } ) activation_key = ActivationKey.info({u"id": activation_key["id"]}) self.assertEqual(len(activation_key["host-collections"]), 0)
def test_remove_host(self, test_data): """@Test: Test that hosts associated to Activation Keys can be removed @Feature: Activation key - Host @Steps: 1. Create Activation key 2. Create different hosts 3. Associate the hosts to Activation key 4. Remove the hosts associated to Activation key @Assert: Hosts successfully removed that are associated to Activation key """ try: org = make_org() activation_key = self._make_activation_key({u"organization-id": org["id"]}) new_host_col = make_host_collection({u"name": test_data["host-col"], u"organization-id": org["id"]}) except CLIFactoryError as err: self.fail(err) # Assert that name matches data passed self.assertEqual(new_host_col["name"], test_data["host-col"], "Names don't match") result = ActivationKey.add_host_collection( {u"name": activation_key["name"], u"host-collection": new_host_col["name"], u"organization-id": org["id"]} ) self.assertEqual(result.return_code, 0, "Failed to add host-col activation key") self.assertEqual(len(result.stderr), 0, "There should not be an error here") result = ActivationKey.info({u"id": activation_key["id"]}) self.assertEqual(result.return_code, 0, "Failed to get info for activation key") self.assertEqual(len(result.stderr), 0, "There should not be an error here") self.assertEqual( result.stdout["host-collections"][0]["name"], test_data["host-col"], "Activation key host-collection added" ) result = ActivationKey.remove_host_collection( {u"name": activation_key["name"], u"host-collection": new_host_col["name"], u"organization-id": org["id"]} ) self.assertEqual(result.return_code, 0, "Failed to remove host-col activation key") self.assertEqual(len(result.stderr), 0, "There should not be an error here") result = ActivationKey.info({u"id": activation_key["id"]}) self.assertEqual(result.return_code, 0, "Failed to get info for activation key") self.assertEqual(len(result.stderr), 0, "There should not be an error here") self.assertEqual(len(result.stdout["host-collections"]), 0, "Activation key host-collection removed")
def test_remove_host(self, test_data): """@Test: Test that hosts associated to Activation Keys can be removed @Feature: Activation key - Host @Steps: 1. Create Activation key 2. Create different hosts 3. Associate the hosts to Activation key 4. Remove the hosts associated to Activation key @Assert: Hosts successfully removed that are associated to Activation key """ try: org = make_org(cached=True) activation_key = self._make_activation_key({ u'organization-id': org['id'], }) new_host_col = make_host_collection({ u'name': test_data['host-col'], u'organization-id': org['id'], }) except CLIFactoryError as err: self.fail(err) # Assert that name matches data passed self.assertEqual(new_host_col['name'], test_data['host-col'], "Names don't match") result = ActivationKey.add_host_collection({ u'name': activation_key['name'], u'host-collection': new_host_col['name'], u'organization-id': org['id'], }) self.assertEqual( result.return_code, 0, 'Failed to add host-col activation key') self.assertEqual( len(result.stderr), 0, 'There should not be an error here') result = ActivationKey.info({ u'id': activation_key['id'], }) self.assertEqual( result.return_code, 0, 'Failed to get info for activation key') self.assertEqual( len(result.stderr), 0, 'There should not be an error here') self.assertEqual( result.stdout['host-collections'][0]['name'], test_data['host-col'], 'Activation key host-collection added') result = ActivationKey.remove_host_collection({ u'name': activation_key['name'], u'host-collection': new_host_col['name'], u'organization-id': org['id'], }) self.assertEqual( result.return_code, 0, 'Failed to remove host-col activation key') self.assertEqual( len(result.stderr), 0, 'There should not be an error here') result = ActivationKey.info({ u'id': activation_key['id'], }) self.assertEqual( result.return_code, 0, 'Failed to get info for activation key') self.assertEqual( len(result.stderr), 0, 'There should not be an error here') self.assertEqual( len(result.stdout['host-collections']), 0, 'Activation key host-collection removed')