summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Frittoli (andreaf) <andrea.frittoli@hp.com>2015-10-16 14:02:38 +0100
committerAndrea Frittoli (andreaf) <andrea.frittoli@hp.com>2015-10-16 14:02:38 +0100
commit4259393446cbb55f5901bce33b13b476c2928c14 (patch)
tree90033457c57c2f3f3750c53b645974c0a8cc23ce
parentca96243e586433a6b4aca769921462079ba67449 (diff)
downloadtempest-lib-4259393446cbb55f5901bce33b13b476c2928c14.tar.gz
Improve unit test coverage for alt_auth data
Using alternative or empty auth_data is only tested for one of the auth parts. Extend tests to cover headers, body and url. Change-Id: I5e11bdb342beb5431f8199391d037018c7f26e9a
-rw-r--r--tempest_lib/tests/test_auth.py24
1 files changed, 21 insertions, 3 deletions
diff --git a/tempest_lib/tests/test_auth.py b/tempest_lib/tests/test_auth.py
index 21399ed..62d95f4 100644
--- a/tempest_lib/tests/test_auth.py
+++ b/tempest_lib/tests/test_auth.py
@@ -198,14 +198,14 @@ class TestKeystoneV2AuthProvider(BaseAuthTestsSetUp):
self.assertIsNone(self.auth_provider.alt_part)
self.assertIsNone(self.auth_provider.alt_auth_data)
- def test_request_with_identical_alt_auth(self):
+ def _test_request_with_identical_alt_auth(self, part):
"""Test alternate but identical auth data for headers
Assert that when the alt data is provided, but it's actually
identical, an exception is raised.
"""
self.auth_provider.set_alt_auth_data(
- 'headers',
+ part,
(fake_identity.TOKEN, self._get_fake_identity()))
filters = {
'service': 'compute',
@@ -217,6 +217,15 @@ class TestKeystoneV2AuthProvider(BaseAuthTestsSetUp):
self.auth_provider.auth_request,
'GET', self.target_url, filters=filters)
+ def test_request_with_identical_alt_auth_headers(self):
+ self._test_request_with_identical_alt_auth('headers')
+
+ def test_request_with_identical_alt_auth_url(self):
+ self._test_request_with_identical_alt_auth('url')
+
+ def test_request_with_identical_alt_auth_body(self):
+ self._test_request_with_identical_alt_auth('body')
+
def test_request_with_alt_part_without_alt_data(self):
"""Test empty alternate auth data
@@ -238,7 +247,7 @@ class TestKeystoneV2AuthProvider(BaseAuthTestsSetUp):
self.assertIsNone(headers)
self.assertEqual(body, None)
- def test_request_with_alt_part_without_alt_data_no_change(self):
+ def _test_request_with_alt_part_without_alt_data_no_change(self, body):
"""Test empty alternate auth data with no effect
Assert that when alt_part is defined, no auth_data is provided,
@@ -256,6 +265,15 @@ class TestKeystoneV2AuthProvider(BaseAuthTestsSetUp):
self.auth_provider.auth_request,
'GET', self.target_url, filters=filters)
+ def test_request_with_alt_part_without_alt_data_no_change_headers(self):
+ self._test_request_with_alt_part_without_alt_data_no_change('headers')
+
+ def test_request_with_alt_part_without_alt_data_no_change_url(self):
+ self._test_request_with_alt_part_without_alt_data_no_change('url')
+
+ def test_request_with_alt_part_without_alt_data_no_change_body(self):
+ self._test_request_with_alt_part_without_alt_data_no_change('body')
+
def test_request_with_bad_service(self):
filters = {
'service': 'BAD_SERVICE',