summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrien Cunin <adrien.cunin@osones.com>2016-01-25 09:53:53 +0100
committerAdrien Cunin <adrien.cunin@osones.com>2016-01-25 09:53:53 +0100
commit7c42ae0dad17be4fa2d9b33da9ba8f1b30666677 (patch)
tree45e8c9015709179779a14482bf6c87f2a4ff2960
parentf4b5b12aaf284cc4c384db91afcbaadf16c6b573 (diff)
downloadtempest-lib-7c42ae0dad17be4fa2d9b33da9ba8f1b30666677.tar.gz
Added __init__.py to tests/services/identity/
This is necessary for the tests to actually be run. Also use sort_keys=True for json.dumps() in both the auth() methods and the unit tests that compare the expected and actual request bodies. Otherwise the order of the keys is unpredictable and the tests fail randomly. Change-Id: Ieb27be22367b419326939c4261388286e6c996c4
-rw-r--r--tempest_lib/services/identity/v2/token_client.py2
-rw-r--r--tempest_lib/services/identity/v3/token_client.py2
-rw-r--r--tempest_lib/tests/services/identity/__init__.py0
-rw-r--r--tempest_lib/tests/services/identity/v2/test_token_client.py4
-rw-r--r--tempest_lib/tests/services/identity/v3/test_token_client.py4
5 files changed, 6 insertions, 6 deletions
diff --git a/tempest_lib/services/identity/v2/token_client.py b/tempest_lib/services/identity/v2/token_client.py
index 621f8b3..2339ff2 100644
--- a/tempest_lib/services/identity/v2/token_client.py
+++ b/tempest_lib/services/identity/v2/token_client.py
@@ -47,7 +47,7 @@ class TokenClient(rest_client.RestClient):
if tenant:
creds['auth']['tenantName'] = tenant
- body = json.dumps(creds)
+ body = json.dumps(creds, sort_keys=True)
resp, body = self.post(self.auth_url, body=body)
self.expected_success(200, resp.status)
diff --git a/tempest_lib/services/identity/v3/token_client.py b/tempest_lib/services/identity/v3/token_client.py
index 5fb64d3..3b978f0 100644
--- a/tempest_lib/services/identity/v3/token_client.py
+++ b/tempest_lib/services/identity/v3/token_client.py
@@ -113,7 +113,7 @@ class V3TokenClient(rest_client.RestClient):
elif domain_name:
creds['auth']['scope'] = dict(domain={'name': domain_name})
- body = json.dumps(creds)
+ body = json.dumps(creds, sort_keys=True)
resp, body = self.post(self.auth_url, body=body)
self.expected_success(201, resp.status)
return rest_client.ResponseBody(resp, body)
diff --git a/tempest_lib/tests/services/identity/__init__.py b/tempest_lib/tests/services/identity/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tempest_lib/tests/services/identity/__init__.py
diff --git a/tempest_lib/tests/services/identity/v2/test_token_client.py b/tempest_lib/tests/services/identity/v2/test_token_client.py
index cc309c7..200b568 100644
--- a/tempest_lib/tests/services/identity/v2/test_token_client.py
+++ b/tempest_lib/tests/services/identity/v2/test_token_client.py
@@ -43,7 +43,7 @@ class TestTokenClientV2(base.TestCase):
'password': 'fake_pass',
},
}
- })
+ }, sort_keys=True)
post_mock.mock.assert_called_once_with('fake_url/tokens',
body=req_dict)
@@ -62,7 +62,7 @@ class TestTokenClientV2(base.TestCase):
'password': 'fake_pass',
},
}
- })
+ }, sort_keys=True)
post_mock.mock.assert_called_once_with('fake_url/tokens',
body=req_dict)
diff --git a/tempest_lib/tests/services/identity/v3/test_token_client.py b/tempest_lib/tests/services/identity/v3/test_token_client.py
index 4ff3109..25a106b 100644
--- a/tempest_lib/tests/services/identity/v3/test_token_client.py
+++ b/tempest_lib/tests/services/identity/v3/test_token_client.py
@@ -48,7 +48,7 @@ class TestTokenClientV2(base.TestCase):
}
},
}
- })
+ }, sort_keys=True)
post_mock.mock.assert_called_once_with('fake_url/auth/tokens',
body=req_dict)
@@ -76,7 +76,7 @@ class TestTokenClientV2(base.TestCase):
}
},
}
- })
+ }, sort_keys=True)
post_mock.mock.assert_called_once_with('fake_url/auth/tokens',
body=req_dict)