diff options
author | Jenkins <jenkins@review.openstack.org> | 2017-01-25 04:45:52 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2017-01-25 04:45:52 +0000 |
commit | 5e23cef55366e09c1b12d692b8666140bed8f549 (patch) | |
tree | 80b8f1d8183afc630dfee16a3fab2a0e1e6b22fa | |
parent | f9e054fd744791c5cd79a6eaa59d729d66bf34fe (diff) | |
parent | ef6ffa651616476d4207549b3121bfde096e16cf (diff) | |
download | python-keystoneclient-ocata-em.tar.gz |
-rw-r--r-- | keystoneclient/base.py | 5 | ||||
-rw-r--r-- | keystoneclient/tests/functional/v3/test_users.py | 23 | ||||
-rw-r--r-- | releasenotes/notes/bp-pci-dss-query-password-expired-users-b0c4b1bbdcf33f16.yaml | 6 |
3 files changed, 33 insertions, 1 deletions
diff --git a/keystoneclient/base.py b/keystoneclient/base.py index 4e393c6..dc449f7 100644 --- a/keystoneclient/base.py +++ b/keystoneclient/base.py @@ -353,7 +353,10 @@ class CrudManager(Manager): return self._head(self.build_url(dict_args_in_out=kwargs)) def _build_query(self, params): - return '?%s' % urllib.parse.urlencode(params) if params else '' + if params is None: + return '' + else: + return '?%s' % urllib.parse.urlencode(params, doseq=True) def build_key_only_query(self, params_list): """Build a query that does not include values, just keys. 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) diff --git a/releasenotes/notes/bp-pci-dss-query-password-expired-users-b0c4b1bbdcf33f16.yaml b/releasenotes/notes/bp-pci-dss-query-password-expired-users-b0c4b1bbdcf33f16.yaml new file mode 100644 index 0000000..2699a7f --- /dev/null +++ b/releasenotes/notes/bp-pci-dss-query-password-expired-users-b0c4b1bbdcf33f16.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Added ability to filter on multiple values with the same parameter key. + For example, we can now filter on user names that contain both ``test`` and + ``user`` using ``keystone.users.list(name__contains=['test', 'user'])``. |