def test_negative_create_with_invalid_dns_id(self): """Attempt to register a domain with invalid id :id: 4aa52167-368a-41ad-87b7-41d468ad41a8 :expectedresults: Error is raised and user friendly message returned :BZ: 1398392 :CaseLevel: Integration :CaseImportance: Medium """ with self.assertRaises(CLIFactoryError) as context: make_domain({ 'name': gen_string('alpha'), 'dns-id': -1, }) valid_messages = ['Invalid smart-proxy id', 'Invalid capsule id'] exception_string = str(context.exception) messages = [ message for message in valid_messages if message in exception_string ] self.assertGreater(len(messages), 0)
def test_positive_add_and_remove_domains(self): """Add and remove domains to organization :id: 97359ffe-4ce6-4e44-9e3f-583d3fdebbc8 :expectedresults: Domains are handled correctly :BZ: 1395229 :steps: 1. Add and remove domain by name 2. Add and remove domain by id :CaseLevel: Integration """ domain_a = make_domain() domain_b = make_domain() Org.add_domain({'domain-id': domain_a['id'], 'name': self.org['name']}) Org.add_domain({'domain': domain_b['name'], 'name': self.org['name']}) org_info = Org.info({'id': self.org['id']}) self.assertEqual(len(org_info['domains']), 2, "Failed to add domains") self.assertIn(domain_a['name'], org_info['domains']) self.assertIn(domain_b['name'], org_info['domains']) Org.remove_domain({ 'domain': domain_a['name'], 'name': self.org['name'] }) Org.remove_domain({'domain-id': domain_b['id'], 'id': self.org['id']}) org_info = Org.info({'id': self.org['id']}) self.assertEqual(len(org_info['domains']), 0, "Failed to remove domains")
def test_negative_create(self, options): """@Test: Create domain with invalid values @Feature: Domain negative create @Assert: Domain is not created """ with self.assertRaises(CLIFactoryError): make_domain(options)
def test_positive_create(self, options): """@Test: Create domain with valid name and description @Feature: Domain positive create @Assert: Domain successfully created """ try: make_domain(options) except CLIFactoryError as err: self.fail(err)
def test_negative_create(self): """Create domain with invalid values @id: 6d3aec19-75dc-41ca-89af-fef0ca37082d @Assert: Domain is not created """ for options in invalid_create_params(): with self.subTest(options): with self.assertRaises(CLIFactoryError): make_domain(options)
def test_negative_create(self): """Create domain with invalid values @Feature: Domain negative create @Assert: Domain is not created """ for options in invalid_create_params(): with self.subTest(options): with self.assertRaises(CLIFactoryError): make_domain(options)
def test_negative_create(self): """@Test: Create domain with invalid values @Feature: Domain negative create @Assert: Domain is not created """ for options in invalid_create_params(): with self.subTest(options): with self.assertRaises(CLIFactoryError): make_domain(options)
def test_negative_create(options): """Create domain with invalid values :id: 6d3aec19-75dc-41ca-89af-fef0ca37082d :parametrized: yes :expectedresults: Domain is not created :CaseImportance: Medium """ with pytest.raises(CLIFactoryError): make_domain(options)
def test_negative_create(self): """Create domain with invalid values :id: 6d3aec19-75dc-41ca-89af-fef0ca37082d :expectedresults: Domain is not created :CaseImportance: Critical """ for options in invalid_create_params(): with self.subTest(options): with self.assertRaises(CLIFactoryError): make_domain(options)
def test_positive_update_domain_by_name(self): """A host can be updated with a new domain. Use entities names for association @id: 9b4fb1b9-a226-4b8a-bfaf-1121de7df5bc @assert: A host is updated and the domain matches @CaseLevel: Integration """ new_domain = make_domain({ 'location': self.host_args.location.name, 'organization': self.host_args.organization.name, }) Host.update({ 'domain': new_domain['name'], 'name': self.host['name'], }) self.host = Host.info({ 'name': '{0}.{1}'.format( self.host['name'].split('.')[0], new_domain['name'], ) }) self.assertEqual(self.host['network']['domain'], new_domain['name'])
def test_positive_delete_parameter(self, options): """@Test: Domain delete-parameter removes parameter @Feature: Domain positive delete-parameter @Assert: Domain parameter is removed """ try: domain = make_domain() except CLIFactoryError as err: self.fail(err) options['domain'] = domain['name'] result = Domain.set_parameter(options) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) result = Domain.delete_parameter({ u'name': options['name'], u'domain-id': domain['id'] }) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) # check - parameter not set result = Domain.info({'name': domain['name']}) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stdout['parameters']), 0)
def test_positive_update(self, options): """@Test: Update domain with valid values @Feature: Domain positive update @Assert: Domain is updated """ try: domain = make_domain({ u'description': gen_string(str_type='utf8') }) except CLIFactoryError as err: self.fail(err) # update description result = Domain.update(dict(options, id=domain['id'])) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) # check - domain updated result = Domain.info({'id': domain['id']}) self.assertEqual(result.return_code, 0) for key, val in options.iteritems(): self.assertEqual(result.stdout[key], val)
def test_positive_update_domain_by_name(self): """A host can be updated with a new domain. Use entities names for association @feature: Hosts @assert: A host is updated and the domain matches """ new_domain = make_domain({ 'location': self.host_args.location.name, 'organization': self.host_args.organization.name, }) Host.update({ 'domain': new_domain['name'], 'name': self.host['name'], }) self.host = Host.info({ 'name': '{0}.{1}'.format( self.host['name'].split('.')[0], new_domain['name'], ) }) self.assertEqual(self.host['domain'], new_domain['name'])
def test_positive_add_and_remove_domains(module_org): """Add and remove domains to organization :id: 97359ffe-4ce6-4e44-9e3f-583d3fdebbc8 :expectedresults: Domains are handled correctly :BZ: 1395229 :steps: 1. Add and remove domain by name 2. Add and remove domain by id :CaseLevel: Integration """ domains = [make_domain() for _ in range(0, 2)] Org.add_domain({'domain-id': domains[0]['id'], 'name': module_org.name}) Org.add_domain({'domain': domains[1]['name'], 'name': module_org.name}) org_info = Org.info({'id': module_org.id}) assert len(org_info['domains']) == 2, "Failed to add domains" assert domains[0]['name'] in org_info['domains'] assert domains[1]['name'] in org_info['domains'] Org.remove_domain({'domain': domains[0]['name'], 'name': module_org.name}) Org.remove_domain({'domain-id': domains[1]['id'], 'id': module_org.id}) org_info = Org.info({'id': module_org.id}) assert len(org_info['domains']) == 0, "Failed to remove domains"
def test_positive_set_parameter(self, options): """@Test: Domain set-parameter with valid key and value @Feature: Domain positive set-parameter @Assert: Domain parameter is set """ try: domain = make_domain() except CLIFactoryError as err: self.fail(err) options['domain-id'] = domain['id'] # set parameter result = Domain.set_parameter(options) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) # check - parameter set result = Domain.info({'id': domain['id']}) self.assertEqual(result.return_code, 0) parameter = { # Sattelite applies lower to parameter's name options['name'].lower(): options['value'], } self.assertDictEqual(parameter, result.stdout['parameters'])
def test_add_domain(self): "Add a domain to an org" org_result = make_org() domain_result = make_domain() return_value = Org().add_domain( {'name': org_result['name'], 'domain': domain_result['name']}) self.assertTrue(return_value.return_code, 0) self.assertFalse(return_value.stderr)
def test_positive_create_update_delete_domain(self): """Create domain, update and delete domain and set parameters :id: 018740bf-1551-4162-b88e-4d4905af097b :expectedresults: Domain successfully created, updated and deleted :CaseImportance: Critical """ options = valid_create_params()[0] location = make_location() org = make_org() domain = make_domain({ u'name': options['name'], u'description': options['description'], u'location-ids': location['id'], u'organization-ids': org['id'] }) self.assertEqual(domain['name'], options['name']) self.assertEqual(domain['description'], options['description']) self.assertIn(location['name'], domain['locations']) self.assertIn(org['name'], domain['organizations']) # set parameter parameter_options = valid_set_params()[0] parameter_options['domain-id'] = domain['id'] Domain.set_parameter(parameter_options) domain = Domain.info({'id': domain['id']}) parameter = { # Satellite applies lower to parameter's name parameter_options['name'].lower(): parameter_options['value'], } self.assertDictEqual(parameter, domain['parameters']) # update domain options = valid_update_params()[0] Domain.update(dict(options, id=domain['id'])) # check - domain updated domain = Domain.info({'id': domain['id']}) for key, val in options.items(): self.assertEqual(domain[key], val) # delete parameter Domain.delete_parameter({ u'name': parameter_options['name'], u'domain-id': domain['id'], }) # check - parameter not set domain = Domain.info({'name': domain['name']}) self.assertEqual(len(domain['parameters']), 0) # delete domain Domain.delete({'id': domain['id']}) with self.assertRaises(CLIReturnCodeError): Domain.info({'id': domain['id']})
def _domain(request): domain = make_domain() @request.addfinalizer def _cleanup(): if Domain.exists(search=('name', domain['name'])): Domain.delete(options={'id': domain['id']}) return domain
def test_positive_create_with_domain(self): """Check if hostgroup with domain can be created @id: c468fcac-9e42-4ee6-a431-abe29b6848ce @Assert: Hostgroup should be created and has domain assigned """ domain = make_domain() hostgroup = make_hostgroup({'domain-id': domain['id']}) self.assertEqual(domain['name'], hostgroup['domain'])
def test_positive_create_with_domain(self): """Check if subnet with domain can be created @id: 7ce7b139-d2b7-44f4-9c1a-1bd591f95334 @Assert: Subnet is created and has new domain assigned """ domain = make_domain() subnet = make_subnet({'domain-ids': domain['id']}) self.assertIn(domain['name'], subnet['domains'])
def test_positive_create_with_domain(self): """Check if subnet with domain can be created @Feature: Subnet - Positive create @Assert: Subnet is created and has new domain assigned """ domain = make_domain() subnet = make_subnet({'domain-ids': domain['id']}) self.assertIn(domain['name'], subnet['domains'])
def test_create_subnet_with_domain(self): """@Test: Check if subnet with domain can be created @Feature: Subnet - Positive create @Assert: Subnet is created and has new domain assigned """ domain = make_domain() subnet = make_subnet({'domain-ids': domain['id']}) self.assertIn(domain['name'], subnet['domains'])
def test_positive_create_with_domain(self): """Check if subnet with domain can be created @id: 7ce7b139-d2b7-44f4-9c1a-1bd591f95334 @Assert: Subnet is created and has new domain assigned """ domain = make_domain() subnet = make_subnet({"domain-ids": domain["id"]}) self.assertIn(domain["name"], subnet["domains"])
def test_positive_add_and_remove_domains(self): """Add and remove domains to organization :id: 97359ffe-4ce6-4e44-9e3f-583d3fdebbc8 :expectedresults: Domains are handled correctly :bz: 1395229 :steps: 1. Add and remove domain by name 2. Add and remove domain by id :CaseLevel: Integration """ org = make_org() domain_a = make_domain() domain_b = make_domain() Org.add_domain({ 'domain-id': domain_a['id'], 'name': org['name'], }) Org.add_domain({ 'domain': domain_b['name'], 'name': org['name'], }) org_info = Org.info({'id': org['id']}) self.assertEqual(len(org_info['domains']), 2, "Failed to add domains") self.assertIn(domain_a['name'], org_info['domains']) self.assertIn(domain_b['name'], org_info['domains']) Org.remove_domain({ 'domain': domain_a['name'], 'name': org['name'], }) Org.remove_domain({ 'domain-id': domain_b['id'], 'id': org['id'], }) org_info = Org.info({'id': org['id']}) self.assertEqual(len(org_info['domains']), 0, "Failed to remove domains")
def test_positive_create_with_org(self): """Check if domain with organization can be created @Feature: Domain - Positive create @Assert: Domain is created and has new organization assigned """ org = make_org() domain = make_domain({'organization-ids': org['id']}) self.assertIn(org['name'], domain['organizations'])
def test_positive_create_with_org(self): """Check if domain with organization can be created @id: f4dfef1b-9b2a-49b8-ade5-031da29e7f6a @Assert: Domain is created and has new organization assigned """ org = make_org() domain = make_domain({'organization-ids': org['id']}) self.assertIn(org['name'], domain['organizations'])
def test_positive_create_with_loc(self): """Check if domain with location can be created @id: 033cc37d-0189-4b88-94cf-97a96839197a @Assert: Domain is created and has new location assigned """ location = make_location() domain = make_domain({'location-ids': location['id']}) self.assertIn(location['name'], domain['locations'])
def test_positive_create(self, options): """@Test: Create domain with valid name and description @Feature: Domain positive create @Assert: Domain successfully created """ domain = make_domain(options) self.assertEqual(domain['name'], options['name']) self.assertEqual(domain['description'], options['description'])
def test_positive_create_with_loc(self): """Check if domain with location can be created @Feature: Domain - Positive create @Assert: Domain is created and has new location assigned """ location = make_location() domain = make_domain({'location-ids': location['id']}) self.assertIn(location['name'], domain['locations'])
def test_create_domain_with_organization(self): """@Test: Check if domain with organization can be created @Feature: Domain - Positive create @Assert: Domain is created and has new organization assigned """ org = make_org() domain = make_domain({'organization-ids': org['id']}) self.assertIn(org['name'], domain['organizations'])
def test_create_domain_with_location(self): """@Test: Check if domain with location can be created @Feature: Domain - Positive create @Assert: Domain is created and has new location assigned """ location = make_location() domain = make_domain({'location-ids': location['id']}) self.assertIn(location['name'], domain['locations'])
def test_positive_create_with_domain(self): """Check if subnet with domain can be created :id: 7ce7b139-d2b7-44f4-9c1a-1bd591f95334 :expectedresults: Subnet is created and has new domain assigned :CaseImportance: Critical """ domain = make_domain() subnet = make_subnet({'domain-ids': domain['id']}) self.assertIn(domain['name'], subnet['domains'])
def test_positive_create_with_domain(self): """Check if hostgroup with domain can be created :id: c468fcac-9e42-4ee6-a431-abe29b6848ce :expectedresults: Hostgroup should be created and has domain assigned :CaseImportance: Critical """ domain = make_domain() hostgroup = make_hostgroup({'domain-id': domain['id']}) self.assertEqual(domain['name'], hostgroup['domain'])
def test_positive_create_with_domain(self): """Check if hostgroup with domain can be created :id: c468fcac-9e42-4ee6-a431-abe29b6848ce :expectedresults: Hostgroup should be created and has domain assigned :CaseImportance: Critical """ domain = make_domain() hostgroup = make_hostgroup({'domain-id': domain['id']}) self.assertEqual(domain['name'], hostgroup['network']['domain'])
def test_positive_create_with_org(self): """Check if domain with organization can be created :id: f4dfef1b-9b2a-49b8-ade5-031da29e7f6a :expectedresults: Domain is created and has new organization assigned :CaseImportance: Critical """ org = make_org() domain = make_domain({'organization-ids': org['id']}) self.assertIn(org['name'], domain['organizations'])
def test_positive_create_with_loc(self): """Check if domain with location can be created :id: 033cc37d-0189-4b88-94cf-97a96839197a :expectedresults: Domain is created and has new location assigned :CaseImportance: Critical """ location = make_location() domain = make_domain({'location-ids': location['id']}) self.assertIn(location['name'], domain['locations'])
def test_create_location_with_domain_by_name(self): """@Test: Create new location with assigned domain to it. Use domain name as a parameter @Feature: Location @Assert: Location created successfully and has correct and expected domain assigned to it """ domain = make_domain() loc = make_location({'domains': domain['name']}) self.assertEqual(loc['domains'][0], domain['name'])
def test_positive_create_with_name_description(self): """Create domain with valid name and description @id: 018740bf-1551-4162-b88e-4d4905af097b @Assert: Domain successfully created """ for options in valid_create_params(): with self.subTest(options): domain = make_domain(options) self.assertEqual(domain['name'], options['name']) self.assertEqual(domain['description'], options['description'])
def test_positive_create_with_domain_by_name(self): """Create new location with assigned domain to it. Use domain name as a parameter @id: 06426c06-744d-44cf-bbba-449ef1f62659 @Assert: Location created successfully and has correct and expected domain assigned to it """ domain = make_domain() loc = make_location({'domains': domain['name']}) self.assertEqual(loc['domains'][0], domain['name'])
def test_positive_create_with_domain_by_id(self): """Create new location with assigned domain to it. Use domain id as a parameter @id: 54507b72-93ea-471e-bfd5-857c44b6abed @Assert: Location created successfully and has correct and expected domain assigned to it """ domain = make_domain() loc = make_location({'domain-ids': domain['id']}) self.assertEqual(loc['domains'][0], domain['name'])
def test_positive_create_with_domain_by_name(self): """Create new location with assigned domain to it. Use domain name as a parameter @Feature: Location @Assert: Location created successfully and has correct and expected domain assigned to it """ domain = make_domain() loc = make_location({'domains': domain['name']}) self.assertEqual(loc['domains'][0], domain['name'])
def test_positive_create_with_name_description(self): """Create domain with valid name and description @Feature: Domain positive create @Assert: Domain successfully created """ for options in valid_create_params(): with self.subTest(options): domain = make_domain(options) self.assertEqual(domain['name'], options['name']) self.assertEqual(domain['description'], options['description'])
def test_positive_delete(self): """@test: Create Domain with valid values then delete it by ID @feature: Domain @assert: Domain is deleted """ for name in valid_data_list(): with self.subTest(name): domain = make_domain({'name': name}) Domain.delete({'id': domain['id']}) with self.assertRaises(CLIReturnCodeError): Domain.info({'id': domain['id']})
def test_positive_create_with_name_description(self): """Create domain with valid name and description @id: 018740bf-1551-4162-b88e-4d4905af097b @Assert: Domain successfully created """ for options in valid_create_params(): with self.subTest(options): domain = make_domain(options) self.assertEqual(domain['name'], options['name']) self.assertEqual( domain['description'], options['description'])
def test_positive_delete_by_id(self): """Create Domain with valid values then delete it by ID @id: b50a5daa-67f8-4ecd-8e03-2a3c492d3c25 @assert: Domain is deleted """ for name in valid_data_list(): with self.subTest(name): domain = make_domain({'name': name}) Domain.delete({'id': domain['id']}) with self.assertRaises(CLIReturnCodeError): Domain.info({'id': domain['id']})
def test_positive_create(self): """@Test: Create domain with valid name and description @Feature: Domain positive create @Assert: Domain successfully created """ for options in valid_create_params(): with self.subTest(options): domain = make_domain(options) self.assertEqual(domain['name'], options['name']) self.assertEqual( domain['description'], options['description'])