def test_positive_update_org_loc(module_perms, function_role): """Create a filter and assign it to another organization and location. :id: 9bb59109-9701-4ef3-95c6-81f387d372da :expectedresults: Filter is created and assigned to new org and loc. :BZ: 1401469 :CaseImportance: Critical """ org = make_org() loc = make_location() filter_ = make_filter({ 'role-id': function_role['id'], 'permissions': module_perms, 'organization-ids': org['id'], 'location-ids': loc['id'], 'override': 1, }) # Update org and loc new_org = make_org() new_loc = make_location() Filter.update({ 'id': filter_['id'], 'permissions': module_perms, 'organization-ids': new_org['id'], 'location-ids': new_loc['id'], 'override': 1, }) filter_ = Filter.info({'id': filter_['id']}) # We expect here only one organization and location assert filter_['organizations'][0] == new_org['name'] assert filter_['locations'][0] == new_loc['name']
def test_positive_update_org_loc(self): """Create a filter and assign it to another organization and location. @id: 9bb59109-9701-4ef3-95c6-81f387d372da @Assert: Filter is created and assigned to new org and loc. """ org = make_org() loc = make_location() filter_ = make_filter({ 'role-id': self.role['id'], 'permissions': self.perms, 'organization-ids': org['id'], 'location-ids': loc['id'] }) # Update org and loc new_org = make_org() new_loc = make_location() Filter.update({ 'id': filter_['id'], 'permissions': self.perms, 'organization-ids': new_org['id'], 'location-ids': new_loc['id'] }) filter_ = Filter.info({'id': filter_['id']}) # We expect here only one organization and location self.assertEqual(filter_['organizations'][0], new_org['name']) self.assertEqual(filter_['locations'][0], new_loc['name'])
def test_positive_update_permissions(self): """Create a filter and update its permissions. @id: 3d6a52d8-2f8f-4f97-a155-9b52888af16e @Assert: Permissions updated. """ filter_ = make_filter({ 'role-id': self.role['id'], 'permissions': self.perms, }) new_perms = [ permission['name'] for permission in Filter.available_permissions( {'resource-type': 'User'}) ] Filter.update({ 'id': filter_['id'], 'permissions': new_perms }) filter_ = Filter.info({'id': filter_['id']}) self.assertEqual( set(filter_['permissions'].split(", ")), set(new_perms) )
def test_positive_update_permissions(self): """Create a filter and update its permissions. :id: 3d6a52d8-2f8f-4f97-a155-9b52888af16e :expectedresults: Permissions updated. :CaseImportance: Critical """ filter_ = make_filter({ 'role-id': self.role['id'], 'permissions': self.perms, }) new_perms = [ permission['name'] for permission in Filter.available_permissions( {'resource-type': 'User'}) ] Filter.update({ 'id': filter_['id'], 'permissions': new_perms }) filter_ = Filter.info({'id': filter_['id']}) self.assertEqual( set(filter_['permissions'].split(", ")), set(new_perms) )
def test_positive_update_role(self): """Create a filter and assign it to another role. :id: 2950b3a1-2bce-447f-9df2-869b1d10eaf5 :expectedresults: Filter is created and assigned to new role. :CaseImportance: Critical """ filter_ = make_filter({'role-id': self.role['id'], 'permissions': self.perms}) # Update with another role new_role = make_role() Filter.update({'id': filter_['id'], 'role-id': new_role['id']}) filter_ = Filter.info({'id': filter_['id']}) self.assertEqual(filter_['role'], new_role['name'])
def test_positive_update_role(self): """Create a filter and assign it to another role. @id: 2950b3a1-2bce-447f-9df2-869b1d10eaf5 @Assert: Filter is created and assigned to new role. """ filter_ = make_filter({ 'role-id': self.role['id'], 'permissions': self.perms, }) # Update with another role new_role = make_role() Filter.update({ 'id': filter_['id'], 'role-id': new_role['id'], }) filter_ = Filter.info({'id': filter_['id']}) self.assertEqual(filter_['role'], new_role['name'])
def test_positive_update_permissions(module_perms, function_role): """Create a filter and update its permissions. :id: 3d6a52d8-2f8f-4f97-a155-9b52888af16e :expectedresults: Permissions updated. :CaseImportance: Critical """ filter_ = make_filter({ 'role-id': function_role['id'], 'permissions': module_perms }) new_perms = [ permission['name'] for permission in Filter.available_permissions( {"search": "resource_type=User"}) ] Filter.update({'id': filter_['id'], 'permissions': new_perms}) filter_ = Filter.info({'id': filter_['id']}) assert set(filter_['permissions'].split(", ")) == set(new_perms)