Fix account generator unit tests
The account generator unit tests patch the set_auth method,
however they do so in a broken way, by setting the return value:
- set_auth does not return anything
- the return value is set to a function
The only reason the unit tests work is because set_auth is actually
not invoked during the tests. So cleaning all this up.
Change-Id: Ied02c38b6a54aad2666abdaed16e454f5c7e65d1
diff --git a/tempest/tests/cmd/test_account_generator.py b/tempest/tests/cmd/test_account_generator.py
index 6773b2f..248cfb0 100644
--- a/tempest/tests/cmd/test_account_generator.py
+++ b/tempest/tests/cmd/test_account_generator.py
@@ -20,7 +20,6 @@
from tempest import config
from tempest.tests import base
from tempest.tests import fake_config
-from tempest.tests.lib import fake_identity
class FakeOpts(object):
@@ -85,14 +84,10 @@
class TestAccountGeneratorV2(base.TestCase, MockHelpersMixin):
identity_version = 2
- identity_response = fake_identity._fake_v2_response
def setUp(self):
super(TestAccountGeneratorV2, self).setUp()
self.mock_config_and_opts(self.identity_version)
- self.useFixture(fixtures.MockPatch(
- 'tempest.lib.auth.AuthProvider.set_auth',
- return_value=self.identity_response))
def test_get_credential_provider(self):
cp = account_generator.get_credential_provider(self.opts)
@@ -115,7 +110,6 @@
class TestAccountGeneratorV3(TestAccountGeneratorV2):
identity_version = 3
- identity_response = fake_identity._fake_v3_response
def setUp(self):
super(TestAccountGeneratorV3, self).setUp()
@@ -145,16 +139,12 @@
class TestGenerateResourcesV2(base.TestCase, MockHelpersMixin):
identity_version = 2
- identity_response = fake_identity._fake_v2_response
cred_client = 'tempest.lib.common.cred_client.V2CredsClient'
dynamic_creds = 'tempest.common.dynamic_creds.DynamicCredentialProvider'
def setUp(self):
super(TestGenerateResourcesV2, self).setUp()
self.mock_config_and_opts(self.identity_version)
- self.useFixture(fixtures.MockPatch(
- 'tempest.lib.auth.AuthProvider.set_auth',
- return_value=self.identity_response))
self.cred_provider = account_generator.get_credential_provider(
self.opts)
self.mock_resource_creation()
@@ -244,7 +234,6 @@
class TestGenerateResourcesV3(TestGenerateResourcesV2):
identity_version = 3
- identity_response = fake_identity._fake_v3_response
cred_client = 'tempest.lib.common.cred_client.V3CredsClient'
def setUp(self):
@@ -255,7 +244,6 @@
class TestDumpAccountsV2(base.TestCase, MockHelpersMixin):
identity_version = 2
- identity_response = fake_identity._fake_v2_response
cred_client = 'tempest.lib.common.cred_client.V2CredsClient'
dynamic_creds = 'tempest.common.dynamic_creds.DynamicCredentialProvider'
domain_is_in = False
@@ -263,9 +251,6 @@
def setUp(self):
super(TestDumpAccountsV2, self).setUp()
self.mock_config_and_opts(self.identity_version)
- self.useFixture(fixtures.MockPatch(
- 'tempest.lib.auth.AuthProvider.set_auth',
- return_value=self.identity_response))
self.cred_provider = account_generator.get_credential_provider(
self.opts)
self.mock_resource_creation()
@@ -337,7 +322,6 @@
class TestDumpAccountsV3(TestDumpAccountsV2):
identity_version = 3
- identity_response = fake_identity._fake_v3_response
cred_client = 'tempest.lib.common.cred_client.V3CredsClient'
domain_is_in = True