diff options
| author | Gorka Eguileor <geguileo@redhat.com> | 2017-01-24 16:53:31 +0100 |
|---|---|---|
| committer | Gorka Eguileor <geguileo@redhat.com> | 2017-01-25 11:09:16 +0100 |
| commit | a1f8a179863e86a48157f4ab85921349af3a30be (patch) | |
| tree | 6bb5110b2fbef4c1c37cdd63dd6f2d06e8321fbc | |
| parent | fe6803c88b8bcb58ab609c777ec0215ea1e4f3a8 (diff) | |
| download | python-cinderclient-a1f8a179863e86a48157f4ab85921349af3a30be.tar.gz | |
Fix test_auth_with_keystone_v3 test
Test is subject to spurious errors due to an incorrect data check.
The check is assuming that a call to json.dumps with different dicts
will always generate the same string, which is incorrect.
This patch tests the JSON data that is sent in the request on its own
based on converting the passed JSON string to a dict and comparing
expected and actual dicts instead of strings.
TrivialFix
Closes-Bug: #1658704
Change-Id: I386cfee2e2c1dc2971d8a760b485505a90f6f120
| -rw-r--r-- | cinderclient/tests/unit/test_http.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/cinderclient/tests/unit/test_http.py b/cinderclient/tests/unit/test_http.py index 1336a03..dca0c35 100644 --- a/cinderclient/tests/unit/test_http.py +++ b/cinderclient/tests/unit/test_http.py @@ -331,12 +331,18 @@ class ClientTest(utils.TestCase): } } } + + # Check data, we cannot do it on the call because the JSON + # dictionary to string can generated different strings. + actual_data = mock_201_request.call_args[1]['data'] + self.assertDictEqual(data, json.loads(actual_data)) + mock_201_request.assert_called_with( "POST", "http://example.com:5000/v3/auth/tokens", headers=headers, allow_redirects=True, - data=json.dumps(data), + data=actual_data, **self.TEST_REQUEST_BASE) test_auth_call() |
