def test_positive_add_and_remove_locations(module_org): """Add and remove a locations from organization :id: 37b63e5c-8fd5-439c-9540-972b597b590a :expectedresults: Locations are handled :BZ: 1395229, 1473387 :steps: 1. add and remove locations by name 2. add and remove locations by id :CaseLevel: Integration """ locations = [make_location() for _ in range(0, 2)] Org.add_location({'location-id': locations[0]['id'], 'name': module_org.name}) Org.add_location({'location': locations[1]['name'], 'name': module_org.name}) org_info = Org.info({'id': module_org.id}) assert len(org_info['locations']) == 2, "Failed to add locations" assert locations[0]['name'] in org_info['locations'] assert locations[1]['name'] in org_info['locations'] Org.remove_location({'location-id': locations[0]['id'], 'id': module_org.id}) Org.remove_location({'location': locations[1]['name'], 'id': module_org.id}) org_info = Org.info({'id': module_org.id}) assert not org_info.get('locations'), "Failed to remove locations"
def test_positive_add_and_remove_locations(self): """Add and remove a locations from organization :id: 37b63e5c-8fd5-439c-9540-972b597b590a :expectedresults: Locations are handled :BZ: 1395229, 1473387 :steps: 1. add and remove locations by name 2. add and remove locations by id :CaseLevel: Integration """ loc_a = make_location() loc_b = make_location() Org.add_location({ 'location-id': loc_a['id'], 'name': self.org['name'] }) Org.add_location({'location': loc_b['name'], 'name': self.org['name']}) org_info = Org.info({'id': self.org['id']}) self.assertEqual(len(org_info['locations']), 2, "Failed to add locations") self.assertIn(loc_a['name'], org_info['locations']) self.assertIn(loc_b['name'], org_info['locations']) Org.remove_location({'location-id': loc_a['id'], 'id': self.org['id']}) Org.remove_location({'location': loc_b['name'], 'id': self.org['id']}) org_info = Org.info({'id': self.org['id']}) self.assertNotIn('locations', org_info, "Failed to remove locations")
def test_positive_add_and_remove_locations(self): """Add and remove a locations from organization :id: 37b63e5c-8fd5-439c-9540-972b597b590a :expectedresults: Locations are handled :BZ: 1395229, 1473387 :steps: 1. add and remove locations by name 2. add and remove locations by id :CaseLevel: Integration """ org = make_org() loc_a = make_location() loc_b = make_location() Org.add_location({ 'location-id': loc_a['id'], 'name': org['name'], }) Org.add_location({ 'location': loc_b['name'], 'name': org['name'], }) org_info = Org.info({'id': org['id']}) self.assertEqual(len(org_info['locations']), 2, "Failed to add locations") self.assertIn(loc_a['name'], org_info['locations']) self.assertIn(loc_b['name'], org_info['locations']) Org.remove_location({ 'location-id': loc_a['id'], 'id': org['id'], }) Org.remove_location({ 'location': loc_b['name'], 'id': org['id'], }) org_info = Org.info({'id': org['id']}) self.assertNotIn('locations', org_info, "Failed to remove locations")
def test_positive_remove_location_by_name(self): """Remove a location from organization by its name @id: 35770afa-1623-448c-af4f-a702851063db @Assert: Location is removed from the org @CaseLevel: Integration """ org = make_org() loc = make_location() Org.add_location({ 'location': loc['name'], 'name': org['name'], }) result = Org.info({'id': org['id']}) self.assertEqual(len(result['locations']), 1) self.assertIn(loc['name'], result['locations']) Org.remove_location({ 'location': loc['name'], 'id': org['id'], }) result = Org.info({'id': org['id']}) self.assertEqual(len(result['locations']), 0)
def test_positive_remove_location_by_id(self): """Remove a location from organization by its id @id: 37b63e5c-8fd5-439c-9540-972b597b590a @Assert: Location is removed from the org @CaseLevel: Integration """ org = make_org() loc = make_location() Org.add_location({ 'location-id': loc['id'], 'name': org['name'], }) result = Org.info({'id': org['id']}) self.assertEqual(len(result['locations']), 1) self.assertIn(loc['name'], result['locations']) Org.remove_location({ 'location-id': loc['id'], 'id': org['id'], }) result = Org.info({'id': org['id']}) self.assertEqual(len(result['locations']), 0)