diff options
author | Samuel Pilla <sp516w@att.com> | 2017-01-20 09:43:14 -0600 |
---|---|---|
committer | Tin Lam <tinlam@gmail.com> | 2017-01-24 19:43:53 -0600 |
commit | ef6ffa651616476d4207549b3121bfde096e16cf (patch) | |
tree | 6fe982ceb43e558da0dcdbb645da7458867326c4 /keystoneclient/tests | |
parent | dcb719d0e51afa0253c144136b41f0e390c48c4c (diff) | |
download | python-keystoneclient-ef6ffa651616476d4207549b3121bfde096e16cf.tar.gz |
Allow Multiple Filters of the Same Key
Before, the way filters were passed in would not allow filtering
on the same key.
For example:
keystone.users.list(name__contains='test', name__contains='user')
This fails because of how kwargs handles key/value pairs.
This patch allows using multiple values for the same filter.
Example:
keystone.users.list(name__contains=['test', 'user'])
Specifying the only one filter value is still functional as expected.
Co-Authored-By: Jeffrey Augustine <ja224e@att.com>
Partially-Implements: bp pci-dss-query-password-expired-users
Change-Id: I89cecf7e18974e7860ba0925840d6264168eabcb
Diffstat (limited to 'keystoneclient/tests')
-rw-r--r-- | keystoneclient/tests/functional/v3/test_users.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/keystoneclient/tests/functional/v3/test_users.py b/keystoneclient/tests/functional/v3/test_users.py index b39c7f9..780ddba 100644 --- a/keystoneclient/tests/functional/v3/test_users.py +++ b/keystoneclient/tests/functional/v3/test_users.py @@ -76,6 +76,29 @@ class UsersTestCase(base.V3ClientTestCase): self.assertIn(user_one.entity, users) self.assertIn(user_two.entity, users) + def test_list_users_with_filters(self): + suffix = uuid.uuid4().hex + user1_ref = { + 'name': 'test_user' + suffix, + 'domain': self.project_domain_id, + 'default_project': self.project_id, + 'password': uuid.uuid4().hex, + 'description': uuid.uuid4().hex} + + user2_ref = { + 'name': fixtures.RESOURCE_NAME_PREFIX + uuid.uuid4().hex, + 'domain': self.project_domain_id, + 'default_project': self.project_id, + 'password': uuid.uuid4().hex, + 'description': uuid.uuid4().hex} + + user1 = self.client.users.create(**user1_ref) + self.client.users.create(**user2_ref) + + users = self.client.users.list(name__contains=['test_user', suffix]) + self.assertEqual(1, len(users)) + self.assertIn(user1, users) + def test_update_user(self): user = fixtures.User(self.client, self.project_domain_id) self.useFixture(user) |