diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-01-30 17:30:00 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-01-30 17:30:00 +0000 |
commit | 23fe39d87938057891e9010d93ecac2eb8c8647f (patch) | |
tree | 384c0ee6a88500ecbbd8c9ef0e4d8a43cb4eb29d | |
parent | 08fd95de147675ad84d55bc53c142954f92d25da (diff) | |
parent | 9a9f47b95f58e9145694e0320709d404a7779a21 (diff) | |
download | python-keystoneclient-23fe39d87938057891e9010d93ecac2eb8c8647f.tar.gz |
Merge "Tests use keep_blank_values when parse_qs"
-rw-r--r-- | keystoneclient/tests/utils.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/keystoneclient/tests/utils.py b/keystoneclient/tests/utils.py index a6f06c5..290d169 100644 --- a/keystoneclient/tests/utils.py +++ b/keystoneclient/tests/utils.py @@ -86,14 +86,23 @@ class TestCase(testtools.TestCase): The qs parameter should be of the format \'foo=bar&abc=xyz\' """ - expected = urlparse.parse_qs(qs) + expected = urlparse.parse_qs(qs, keep_blank_values=True) parts = urlparse.urlparse(self.requests.last_request.url) - querystring = urlparse.parse_qs(parts.query) + querystring = urlparse.parse_qs(parts.query, keep_blank_values=True) self.assertEqual(expected, querystring) def assertQueryStringContains(self, **kwargs): + """Verify the query string contains the expected parameters. + + This method is used to verify that the query string for the most recent + request made contains all the parameters provided as ``kwargs``, and + that the value of each parameter contains the value for the kwarg. If + the value for the kwarg is an empty string (''), then all that's + verified is that the parameter is present. + + """ parts = urlparse.urlparse(self.requests.last_request.url) - qs = urlparse.parse_qs(parts.query) + qs = urlparse.parse_qs(parts.query, keep_blank_values=True) for k, v in six.iteritems(kwargs): self.assertIn(k, qs) |