Skip to content

Commit

Permalink
Fix incorrect test for list_users
Browse files Browse the repository at this point in the history
The current test would not fail if incorrect data was returned by
the driver.  The list_roles test also has the same issue.

Fixes bug 1222574

Change-Id: Icc5e76e9453436ac208c5f262d0dd4082b700d02
  • Loading branch information
henrynash committed Sep 9, 2013
1 parent dac281a commit 2d9cdce
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions keystone/tests/test_backend.py
Expand Up @@ -1739,8 +1739,10 @@ def test_update_user_invalid_name_fails(self):

def test_list_users(self):
users = self.identity_api.list_users()
for test_user in default_fixtures.USERS:
self.assertTrue(x for x in users if x['id'] == test_user['id'])
self.assertEqual(len(default_fixtures.USERS), len(users))
user_ids = set(user['id'] for user in users)
expected_user_ids = set(user['id'] for user in default_fixtures.USERS)
self.assertEqual(expected_user_ids, user_ids)

def test_list_groups(self):
group1 = {
Expand Down Expand Up @@ -1810,8 +1812,10 @@ def test_list_projects_for_alternate_domain(self):

def test_list_roles(self):
roles = self.identity_api.list_roles()
for test_role in default_fixtures.ROLES:
self.assertTrue(x for x in roles if x['id'] == test_role['id'])
self.assertEqual(len(default_fixtures.ROLES), len(roles))
role_ids = set(role['id'] for role in roles)
expected_role_ids = set(role['id'] for role in default_fixtures.ROLES)
self.assertEqual(expected_role_ids, role_ids)

def test_delete_project_with_role_assignments(self):
tenant = {'id': uuid.uuid4().hex, 'name': uuid.uuid4().hex,
Expand Down

0 comments on commit 2d9cdce

Please sign in to comment.