def test_positive_update_from_compresources_to_compresource(self): """Create location with multiple (not less than three) compute resources assigned to it. Try to update location and overwrite all compute resources with a new single compute resource. Use compute resource id as a parameter :id: 3a547413-53dc-4305-84e9-8db7a6bed3b2 :expectedresults: Location updated successfully and has correct compute resource assigned to it :CaseImportance: Critical """ resources_amount = randint(3, 5) resources = [make_compute_resource() for _ in range(resources_amount)] loc = make_location({ 'compute-resource-ids': [resource['id'] for resource in resources], }) self.assertEqual(len(loc['compute-resources']), resources_amount) for resource in resources: self.assertIn(resource['name'], loc['compute-resources']) new_resource = make_compute_resource() Location.update({ 'compute-resource-ids': new_resource['id'], 'id': loc['id'], }) loc = Location.info({'id': loc['id']}) self.assertEqual(len(loc['compute-resources']), 1) self.assertEqual(loc['compute-resources'][0], new_resource['name'])
def test_positive_update_from_compresources_to_compresource(self): """Create location with multiple (not less than three) compute resources assigned to it. Try to update location and overwrite all compute resources with a new single compute resource. Use compute resource id as a parameter @Feature: Location @Assert: Location updated successfully and has correct compute resource assigned to it """ resources_amount = randint(3, 5) resources = [make_compute_resource() for _ in range(resources_amount)] loc = make_location({ 'compute-resource-ids': [resource['id'] for resource in resources], }) self.assertEqual(len(loc['compute-resources']), resources_amount) for resource in resources: self.assertIn(resource['name'], loc['compute-resources']) new_resource = make_compute_resource() Location.update({ 'compute-resource-ids': new_resource['id'], 'id': loc['id'], }) loc = Location.info({'id': loc['id']}) self.assertEqual(len(loc['compute-resources']), 1) self.assertEqual(loc['compute-resources'][0], new_resource['name'])
def test_positive_update_from_hostgroups_to_hostgroups(self): """Create location with multiple (three) host groups assigned to it. Try to update location and overwrite all host groups by new multiple (two) host groups. Use host groups name as a parameter :id: e53504d0-8328-485c-bc8c-36ea9a2ad3e1 :expectedresults: Location updated successfully and has correct and expected host groups assigned to it :CaseImportance: Critical """ host_groups = [make_hostgroup() for _ in range(3)] loc = make_location({ 'hostgroups': [hg['name'] for hg in host_groups], }) self.assertEqual(len(loc['hostgroups']), 3) for host_group in host_groups: self.assertIn(host_group['name'], loc['hostgroups']) new_host_groups = [make_hostgroup() for _ in range(2)] Location.update({ 'hostgroups': [hg['name'] for hg in new_host_groups], 'id': loc['id'], }) loc = Location.info({'id': loc['id']}) self.assertEqual(len(loc['hostgroups']), 2) for host_group in new_host_groups: self.assertIn(host_group['name'], loc['hostgroups'])
def test_update_location_with_multiple_comp_resources_to_single(self): """@Test: Create location with multiple (not less than three) compute resources assigned to it. Try to update location and overwrite all compute resources with a new single compute resource. Use compute resource id as a parameter @Feature: Location @Assert: Location updated successfully and has correct compute resource assigned to it """ resources_amount = randint(3, 5) resources = [make_compute_resource() for _ in range(resources_amount)] loc = make_location({ 'compute-resource-ids': [resource['id'] for resource in resources], }) self.assertEqual(len(loc['compute-resources']), resources_amount) for resource in resources: self.assertIn(resource['name'], loc['compute-resources']) new_resource = make_compute_resource() Location.update({ 'compute-resource-ids': new_resource['id'], 'id': loc['id'], }) loc = Location.info({'id': loc['id']}) self.assertEqual(len(loc['compute-resources']), 1) self.assertEqual(loc['compute-resources'][0], new_resource['name'])
def test_update_location_with_multiple_host_group_to_multiple(self): """@Test: Create location with multiple (three) host groups assigned to it. Try to update location and overwrite all host groups by new multiple (two) host groups. Use host groups name as a parameter @Feature: Location @Assert: Location updated successfully and has correct and expected host groups assigned to it """ host_groups = [make_hostgroup() for _ in range(3)] loc = make_location({ 'hostgroups': [hg['name'] for hg in host_groups], }) self.assertEqual(len(loc['hostgroups']), 3) for host_group in host_groups: self.assertIn(host_group['name'], loc['hostgroups']) new_host_groups = [make_hostgroup() for _ in range(2)] Location.update({ 'hostgroups': [hg['name'] for hg in new_host_groups], 'id': loc['id'], }) loc = Location.info({'id': loc['id']}) self.assertEqual(len(loc['hostgroups']), 2) for host_group in new_host_groups: self.assertIn(host_group['name'], loc['hostgroups'])
def test_positive_remove_capsule_by_id(self): """Remove a capsule from organization by its id :id: 98681f4f-a5e2-44f6-8879-d23ad90b4c59 :expectedresults: Capsule is removed from the org :CaseLevel: Integration """ loc = make_location() proxy = make_proxy() # Add capsule and location to cleanup list self.addCleanup(capsule_cleanup, proxy['id']) self.addCleanup(location_cleanup, loc['id']) Location.add_smart_proxy({ 'id': loc['id'], 'smart-proxy-id': proxy['id'], }) Location.remove_smart_proxy({ 'id': loc['id'], 'smart-proxy-id': proxy['id'], }) loc = Location.info({'id': loc['id']}) self.assertNotIn(proxy['name'], loc['smart-proxies'])
def test_positive_remove_capsule_by_name(self): """Remove a capsule from organization by its name :id: 91dcafbe-5f52-48af-b5c7-9319b2929f5a :expectedresults: Capsule is removed from the org :CaseLevel: Integration """ loc = make_location() proxy = make_proxy() # Add capsule and location to cleanup list self.addCleanup(capsule_cleanup, proxy['id']) self.addCleanup(location_cleanup, loc['id']) Location.add_smart_proxy({ 'name': loc['name'], 'smart-proxy': proxy['name'], }) Location.remove_smart_proxy({ 'name': loc['name'], 'smart-proxy': proxy['name'], }) loc = Location.info({'name': loc['name']}) self.assertNotIn(proxy['name'], loc['smart-proxies'])
def test_update_location_with_subnet_by_name(self): """@Test: Create new location with assigned subnet to it. Try to update that location and change assigned subnet on another one. Use subnet name as a parameter @Feature: Location @Assert: Location is updated successfully and has correct subnet with expected network address assigned to it """ subnet = [make_subnet() for _ in range(2)] loc = make_location({'subnets': subnet[0]['name']}) self.assertIn(subnet[0]['name'], loc['subnets'][0]) self.assertIn(subnet[0]['network'], loc['subnets'][0]) result = Location.update({ 'id': loc['id'], 'subnets': subnet[1]['name'], }) self.assertEqual(result.return_code, 0) result = Location.info({'id': loc['id']}) self.assertEqual(result.return_code, 0) self.assertIn(subnet[1]['name'], result.stdout['subnets'][0]) self.assertIn(subnet[1]['network'], result.stdout['subnets'][0])
def test_positive_update_from_hostgroups_to_hostgroups(self): """Create location with multiple (three) host groups assigned to it. Try to update location and overwrite all host groups by new multiple (two) host groups. Use host groups name as a parameter @Feature: Location @Assert: Location updated successfully and has correct and expected host groups assigned to it """ host_groups = [make_hostgroup() for _ in range(3)] loc = make_location({ 'hostgroups': [hg['name'] for hg in host_groups], }) self.assertEqual(len(loc['hostgroups']), 3) for host_group in host_groups: self.assertIn(host_group['name'], loc['hostgroups']) new_host_groups = [make_hostgroup() for _ in range(2)] Location.update({ 'hostgroups': [hg['name'] for hg in new_host_groups], 'id': loc['id'], }) loc = Location.info({'id': loc['id']}) self.assertEqual(len(loc['hostgroups']), 2) for host_group in new_host_groups: self.assertIn(host_group['name'], loc['hostgroups'])
def test_positive_add_update_remove_parameter(self, request): """Add, update and remove parameter to location :id: 61b564f2-a42a-48de-833d-bec3a127d0f5 :expectedresults: Parameter is added to the location :CaseImportance: Critical """ # Create param_name = gen_string('alpha') param_value = gen_string('alpha') param_new_value = gen_string('alpha') location = _location(request) Location.set_parameter( {'name': param_name, 'value': param_value, 'location-id': location['id']} ) location = Location.info({'id': location['id']}) assert len(location['parameters']) == 1 assert param_value == location['parameters'][param_name.lower()] # Update Location.set_parameter( {'name': param_name, 'value': param_new_value, 'location': location['name']} ) location = Location.info({'id': location['id']}) assert len(location['parameters']) == 1 assert param_new_value == location['parameters'][param_name.lower()] # Remove Location.delete_parameter({'name': param_name, 'location': location['name']}) location = Location.info({'id': location['id']}) assert len(location['parameters']) == 0 assert param_name.lower() not in location['parameters']
def test_positive_add_update_remove_parameter(self): """Add, update and remove parameter to location :id: 61b564f2-a42a-48de-833d-bec3a127d0f5 :expectedresults: Parameter is added to the location :CaseImportance: Critical """ # Create param_name = gen_string('alpha') param_value = gen_string('alpha') param_new_value = gen_string('alpha') location = make_location() Location.set_parameter( {'name': param_name, 'value': param_value, 'location-id': location['id']} ) location = Location.info({'id': location['id']}) self.assertEqual(len(location['parameters']), 1) self.assertEqual(param_value, location['parameters'][param_name.lower()]) # Update Location.set_parameter( {'name': param_name, 'value': param_new_value, 'location': location['name']} ) location = Location.info({'id': location['id']}) self.assertEqual(len(location['parameters']), 1) self.assertEqual(param_new_value, location['parameters'][param_name.lower()]) # Remove Location.delete_parameter({'name': param_name, 'location': location['name']}) location = Location.info({'id': location['id']}) self.assertEqual(len(location['parameters']), 0) self.assertNotIn(param_name.lower(), location['parameters'])
def test_delete_location_by_id(self): """@Test: Try to delete location using id of that location as a parameter @Feature: Location @Assert: Location is deleted successfully """ loc = make_location() Location.delete({'id': loc['id']}) with self.assertRaises(CLIReturnCodeError): Location.info({'id': loc['id']})
def test_positive_delete_by_id(self): """Try to delete location using id of that location as a parameter @id: 71e394e3-85e6-456d-b03d-6787db9059aa @Assert: Location is deleted successfully """ loc = make_location() Location.delete({'id': loc['id']}) with self.assertRaises(CLIReturnCodeError): Location.info({'id': loc['id']})
def test_positive_delete_by_id(self): """Try to delete location using id of that location as a parameter @Feature: Location @Assert: Location is deleted successfully """ loc = make_location() Location.delete({'id': loc['id']}) with self.assertRaises(CLIReturnCodeError): Location.info({'id': loc['id']})
def test_positive_add_capsule_by_id(self): """Add a capsule to organization by its ID @feature: Organization @assert: Capsule is added to the org """ loc = make_location() proxy = make_proxy() Location.add_smart_proxy({ 'name': loc['name'], 'smart-proxy-id': proxy['id'], }) loc = Location.info({'name': loc['name']}) self.assertIn(proxy['name'], loc['smart-proxies'])
def test_update_location_with_domain_by_id_negative(self): """@Test: Try to update existing location with incorrect domain. Use domain id as a parameter @Feature: Location @Assert: Location is not updated """ loc = make_location() with self.assertRaises(CLIReturnCodeError): Location.update({ 'domain-ids': gen_string('numeric', 6), 'id': loc['id'], })
def test_update_location_with_template_by_name_negative(self): """@Test: Try to update existing location with incorrect config template. Use template name as a parameter @Feature: Location @Assert: Location is not updated """ loc = make_location() with self.assertRaises(CLIReturnCodeError): Location.update({ 'config-templates': gen_string('utf8', 80), 'id': loc['id'], })
def test_negative_update_with_domain_by_id(self): """Try to update existing location with incorrect domain. Use domain id as a parameter @Feature: Location @Assert: Location is not updated """ loc = make_location() with self.assertRaises(CLIReturnCodeError): Location.update({ 'domain-ids': gen_string('numeric', 6), 'id': loc['id'], })
def test_negative_update_with_template_by_name(self): """Try to update existing location with incorrect config template. Use template name as a parameter @id: 937730ff-bb46-437b-bfc7-915045d1782c @Assert: Location is not updated """ loc = make_location() with self.assertRaises(CLIReturnCodeError): Location.update({ 'config-templates': gen_string('utf8', 80), 'id': loc['id'], })
def test_negative_update_with_domain_by_id(self): """Try to update existing location with incorrect domain. Use domain id as a parameter @id: ec49ea4d-754a-4958-8180-f61eb6d8cede @Assert: Location is not updated """ loc = make_location() with self.assertRaises(CLIReturnCodeError): Location.update({ 'domain-ids': gen_string('numeric', 6), 'id': loc['id'], })
def test_positive_delete_by_id(self): """Try to delete location using id of that location as a parameter :id: 71e394e3-85e6-456d-b03d-6787db9059aa :expectedresults: Location is deleted successfully :CaseImportance: Critical """ loc = make_location() Location.delete({'id': loc['id']}) with self.assertRaises(CLIReturnCodeError): Location.info({'id': loc['id']})
def test_negative_update_with_template_by_name(self): """Try to update existing location with incorrect config template. Use template name as a parameter @Feature: Location @Assert: Location is not updated """ loc = make_location() with self.assertRaises(CLIReturnCodeError): Location.update({ 'config-templates': gen_string('utf8', 80), 'id': loc['id'], })
def test_negative_update_with_name(self): """Try to update location using invalid names only @Feature: Location @Assert: Location is not updated """ for invalid_name in invalid_values_list(): with self.subTest(invalid_name): loc = make_location() with self.assertRaises(CLIReturnCodeError): Location.update({ 'id': loc['id'], 'new-name': invalid_name, })
def test_update_location_with_different_names_negative(self): """@Test: Try to update location using invalid names only @Feature: Location @Assert: Location is not updated """ for invalid_name in invalid_values_list(): with self.subTest(invalid_name): loc = make_location() with self.assertRaises(CLIReturnCodeError): Location.update({ 'id': loc['id'], 'new-name': invalid_name, })
def test_positive_delete_by_name(self): """Try to delete location using name of that location as a parameter. Use different value types for testing. @id: b44e56e4-00f0-4b7c-bef6-48b10c7b2b59 @Assert: Location is deleted successfully """ for name in valid_loc_data_list(): with self.subTest(name): loc = make_location({'name': name}) self.assertEqual(loc['name'], name) Location.delete({'name': loc['name']}) with self.assertRaises(CLIReturnCodeError): Location.info({'id': loc['id']})
def test_positive_delete_by_name(self): """Try to delete location using name of that location as a parameter. Use different value types for testing. @Feature: Location @Assert: Location is deleted successfully """ for name in valid_loc_data_list(): with self.subTest(name): loc = make_location({'name': name}) self.assertEqual(loc['name'], name) Location.delete({'name': loc['name']}) with self.assertRaises(CLIReturnCodeError): Location.info({'id': loc['id']})
def test_negative_update_with_name(self): """Try to update location using invalid names only @id: a41abf03-61ca-4201-8a80-7062a6196851 @Assert: Location is not updated """ for invalid_name in invalid_values_list(): with self.subTest(invalid_name): loc = make_location() with self.assertRaises(CLIReturnCodeError): Location.update({ 'id': loc['id'], 'new-name': invalid_name, })
def test_delete_location_by_name(self): """@Test: Try to delete location using name of that location as a parameter. Use different value types for testing. @Feature: Location @Assert: Location is deleted successfully """ for name in valid_data_list(): with self.subTest(name): loc = make_location({'name': name}) self.assertEqual(loc['name'], name) Location.delete({'name': loc['name']}) with self.assertRaises(CLIReturnCodeError): Location.info({'id': loc['id']})
def test_delete_location_by_id(self): """@Test: Try to delete location using id of that location as a parameter @Feature: Location @Assert: Location is deleted successfully """ loc = make_location() result = Location.delete({'id': loc['id']}) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) result = Location.info({'id': loc['id']}) self.assertNotEqual(result.return_code, 0) self.assertNotEqual(len(result.stderr), 0)
def test_negative_update_with_template_by_name(self): """Try to update existing location with incorrect config template. Use template name as a parameter :id: 937730ff-bb46-437b-bfc7-915045d1782c :expectedresults: Location is not updated :CaseImportance: Critical """ loc = make_location() with self.assertRaises(CLIReturnCodeError): Location.update({ 'config-templates': gen_string('utf8', 80), 'id': loc['id'], })
def test_negative_update_with_domain_by_id(self): """Try to update existing location with incorrect domain. Use domain id as a parameter :id: ec49ea4d-754a-4958-8180-f61eb6d8cede :expectedresults: Location is not updated :CaseImportance: Critical """ loc = make_location() with self.assertRaises(CLIReturnCodeError): Location.update({ 'domain-ids': gen_string('numeric', 6), 'id': loc['id'], })
def test_positive_update_with_name(self): """Try to update location using different value types as a name @id: 09fa55a5-c688-4bd3-94df-8ab7a2ccda84 @Assert: Location is updated successfully and has proper and expected name """ loc = make_location() for new_name in valid_loc_data_list(): with self.subTest(new_name): Location.update({ 'id': loc['id'], 'new-name': new_name, }) loc = Location.info({'id': loc['id']}) self.assertEqual(loc['name'], new_name)
def test_positive_delete_by_name(self): """Try to delete location using name of that location as a parameter. Use different value types for testing. :id: b44e56e4-00f0-4b7c-bef6-48b10c7b2b59 :expectedresults: Location is deleted successfully :CaseImportance: Critical """ for name in valid_loc_data_list(): with self.subTest(name): loc = make_location({'name': name}) self.assertEqual(loc['name'], name) Location.delete({'name': loc['name']}) with self.assertRaises(CLIReturnCodeError): Location.info({'id': loc['id']})
def test_update_location_with_different_names(self): """@Test: Try to update location using different value types as a name @Feature: Location @Assert: Location is updated successfully and has proper and expected name """ loc = make_location() for new_name in valid_data_list(): with self.subTest(new_name): Location.update({ 'id': loc['id'], 'new-name': new_name, }) loc = Location.info({'id': loc['id']}) self.assertEqual(loc['name'], new_name)
def test_positive_update_with_name(self): """Try to update location using different value types as a name @Feature: Location @Assert: Location is updated successfully and has proper and expected name """ loc = make_location() for new_name in valid_loc_data_list(): with self.subTest(new_name): Location.update({ 'id': loc['id'], 'new-name': new_name, }) loc = Location.info({'id': loc['id']}) self.assertEqual(loc['name'], new_name)
def test_negative_update_with_name(self): """Try to update location using invalid names only :id: a41abf03-61ca-4201-8a80-7062a6196851 :expectedresults: Location is not updated :CaseImportance: Critical """ for invalid_name in invalid_values_list(): with self.subTest(invalid_name): loc = make_location() with self.assertRaises(CLIReturnCodeError): Location.update({ 'id': loc['id'], 'new-name': invalid_name, })
def test_delete_location_by_name(self, name): """@Test: Try to delete location using name of that location as a parameter. Use different value types for testing. @Feature: Location @Assert: Location is deleted successfully """ loc = make_location({'name': name}) self.assertEqual(loc['name'], name) result = Location.delete({'name': loc['name']}) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) result = Location.info({'id': loc['id']}) self.assertNotEqual(result.return_code, 0) self.assertNotEqual(len(result.stderr), 0)
def test_positive_find_default_loc(self): """Check if 'Default Location' is present @id: 11cf0d06-78ff-47e8-9d50-407a2ea31988 @Assert: 'Default Location' is found """ result = Location.info({u'name': DEFAULT_LOC}) self.assertEqual(result['name'], DEFAULT_LOC)
def test_positive_find_default_loc(self): """Check if 'Default Location' is present @Feature: Smoke Test @Assert: 'Default Location' is found """ result = Location.info({u'name': DEFAULT_LOC}) self.assertEqual(result['name'], DEFAULT_LOC)
def test_positive_cli_find_default_loc(): """Check if 'Default Location' is present :id: 11cf0d06-78ff-47e8-9d50-407a2ea31988 :expectedresults: 'Default Location' is found """ result = Location.info({'name': DEFAULT_LOC}) assert result['name'] == DEFAULT_LOC
def test_positive_generate_ansible_template(self): """Report template named 'Ansible Inventory' (default name is specified in settings) must be present in Satellite 6.7 and later in order to provide enhanced functionality for Ansible Tower inventory synchronization with Satellite. :id: f1f7adfc-9601-4498-95c8-3e82e2b36583 :setup: 1. A user with minimal required permissions: 'Ansible Tower Inventory Reader' role 2. A fake host to be checked in report output :steps: 1. Check settings for default Ansible Inventory template name and ensure the template is present 2. Try to render the template using the user with ATIR role 3. Check the fake host is present in the output :expectedresults: Report template is present, renederable and provides output :CaseImportance: Medium """ settings = Settings.list({'search': 'name=ansible_inventory_template'}) assert 1 == len(settings) template_name = settings[0]['value'] report_list = ReportTemplate.list() assert template_name in [rt['name'] for rt in report_list] login = gen_string('alpha').lower() password = gen_string('alpha').lower() loc = Location.info({'name': DEFAULT_LOC}) org = Org.info({'name': DEFAULT_ORG}) user = make_user( { 'login': login, 'password': password, 'organization-ids': org['id'], 'location-ids': loc['id'], } ) User.add_role({'login': user['login'], 'role': 'Ansible Tower Inventory Reader'}) host_name = gen_string('alpha').lower() host = make_fake_host({'name': host_name}) schedule = ReportTemplate.with_user(username=user['login'], password=password).schedule( {'name': template_name} ) report_data = ReportTemplate.with_user( username=user['login'], password=password ).report_data({'id': template_name, 'job-id': schedule[0].split("Job ID: ", 1)[1]}) assert host['name'] in [item.split(',')[1] for item in report_data if len(item) > 0]
def test_positive_update_parent(self): """Update location's parent location :id: 34522d1a-1190-48d8-9285-fc9a9bcf6c6a :customerscenario: true :BZ: 1299802 :expectedresults: Location was updated successfully :CaseImportance: High """ parent_loc = make_location() loc = make_location({'parent-id': parent_loc['id']}) new_parent_loc = make_location() Location.update({'id': loc['id'], 'parent-id': new_parent_loc['id']}) loc = Location.info({'id': loc['id']}) self.assertEqual(loc['parent'], new_parent_loc['name'])
def test_positive_add_capsule_by_name(self): """Add a capsule to location by its name :id: 32b1e969-a1a8-4d65-bde9-a825ab542b1d :expectedresults: Capsule is added to the org :CaseLevel: Integration """ loc = make_location() proxy = self._make_proxy() self.addCleanup(location_cleanup, loc['id']) Location.add_smart_proxy({ 'name': loc['name'], 'smart-proxy': proxy['name'], }) loc = Location.info({'name': loc['name']}) self.assertIn(proxy['name'], loc['smart-proxies'])
def test_positive_remove_capsule_by_name(self): """Remove a capsule from organization by its name @Feature: Organization @Assert: Capsule is removed from the org """ loc = make_location() proxy = make_proxy() Location.add_smart_proxy({ 'name': loc['name'], 'smart-proxy': proxy['name'], }) Location.remove_smart_proxy({ 'name': loc['name'], 'smart-proxy': proxy['name'], }) loc = Location.info({'name': loc['name']}) self.assertNotIn(proxy['name'], loc['smart-proxies'])
def test_positive_add_capsule_by_id(self): """Add a capsule to location by its ID :id: 15e3c1e6-4fa3-4965-8808-a9ba01d1c050 :expectedresults: Capsule is added to the org :CaseLevel: Integration """ loc = make_location() proxy = self._make_proxy() self.addCleanup(location_cleanup, loc['id']) Location.add_smart_proxy({ 'name': loc['name'], 'smart-proxy-id': proxy['id'], }) loc = Location.info({'name': loc['name']}) self.assertIn(proxy['name'], loc['smart-proxies'])
def test_positive_update_with_name(self): """Try to update location using different value types as a name :id: 09fa55a5-c688-4bd3-94df-8ab7a2ccda84 :expectedresults: Location is updated successfully and has proper and expected name :CaseImportance: Critical """ loc = make_location() for new_name in valid_loc_data_list(): with self.subTest(new_name): Location.update({ 'id': loc['id'], 'new-name': new_name, }) loc = Location.info({'id': loc['id']}) self.assertEqual(loc['name'], new_name)
def test_negative_update_parent_with_self(self): """Attempt to set a location as its own parent :id: 26e07124-9043-4597-8513-7147135a8426 :BZ: 1299802 :expectedresults: Location was not updated :CaseImportance: High """ parent_loc = make_location() loc = make_location({'parent-id': parent_loc['id']}) with self.assertRaises(CLIReturnCodeError): Location.update({ 'id': loc['id'], 'parent-id': loc['id'], }) loc = Location.info({'id': loc['id']}) self.assertEqual(loc['parent'], parent_loc['name'])
def test_positive_update_parent(self, request): """Update location's parent location :id: 34522d1a-1190-48d8-9285-fc9a9bcf6c6a :customerscenario: true :BZ: 1299802 :expectedresults: Location was updated successfully :CaseImportance: High """ parent_location = _location(request) location = _location(request, {'parent-id': parent_location['id']}) parent_location_2 = _location(request) Location.update({'id': location['id'], 'parent-id': parent_location_2['id']}) location = Location.info({'id': location['id']}) assert location['parent'] == parent_location_2['name']
def test_positive_update_with_user_by_id(self): """Create new location with assigned user to it. Try to update that location and change assigned user on another one. Use user id as a parameter @id: 123a8a28-f81d-439a-82d0-5c3d814d1a25 @Assert: Location is updated successfully and has correct user assigned to it """ user = [make_user() for _ in range(2)] loc = make_location({'user-ids': user[0]['id']}) self.assertEqual(loc['users'][0], user[0]['login']) Location.update({ 'id': loc['id'], 'user-ids': user[1]['id'], }) loc = Location.info({'id': loc['id']}) self.assertEqual(loc['users'][0], user[1]['login'])