Move fake get_credentials methods to test_auth

fake_auth_provider needed fake_credentials which needs auth module which
needs keystone service clients for implementing fake get_credentials and
get_default_credentials. So this dependency blocked moving rest_client
module to tempest-lib because test_rest_client needs fake_auth_provider
like:

  rest_client
     -> test_rest_client
        -> fake_auth_provider
           -> fake_credentials
              -> auth
                 -> identity_client of v2 and v3
                    -> rest_client

So a dependency loop existed.
Both get_credentials and get_default_credentials of fake_auth_provider
were used in test_auth only.
So this patch moves fake get_credentials methods to test_auth for breaking
the dependency loop.

Change-Id: Id12341de52204e2c428e10b4b758b700b0fbab09
This commit is contained in:
Ken'ichi Ohmichi 2015-01-15 07:02:06 +00:00
parent 2931fa6ffe
commit c5d607d92a
2 changed files with 10 additions and 14 deletions

View File

@ -13,16 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest.tests import fake_credentials
def get_default_credentials(credential_type, fill_in=True):
return fake_credentials.FakeCredentials()
def get_credentials(credential_type=None, fill_in=True, **kwargs):
return fake_credentials.FakeCredentials()
class FakeAuthProvider(object):

View File

@ -24,13 +24,20 @@ from tempest import exceptions
from tempest.services.identity.json import identity_client as v2_client
from tempest.services.identity.v3.json import identity_client as v3_client
from tempest.tests import base
from tempest.tests import fake_auth_provider
from tempest.tests import fake_config
from tempest.tests import fake_credentials
from tempest.tests import fake_http
from tempest.tests import fake_identity
def fake_get_default_credentials(credential_type, fill_in=True):
return fake_credentials.FakeCredentials()
def fake_get_credentials(credential_type=None, fill_in=True, **kwargs):
return fake_credentials.FakeCredentials()
class BaseAuthTestsSetUp(base.TestCase):
_auth_provider_class = None
credentials = fake_credentials.FakeCredentials()
@ -46,10 +53,9 @@ class BaseAuthTestsSetUp(base.TestCase):
self.useFixture(fake_config.ConfigFixture())
self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
self.fake_http = fake_http.fake_httplib2(return_type=200)
self.stubs.Set(auth, 'get_credentials',
fake_auth_provider.get_credentials)
self.stubs.Set(auth, 'get_credentials', fake_get_credentials)
self.stubs.Set(auth, 'get_default_credentials',
fake_auth_provider.get_default_credentials)
fake_get_default_credentials)
self.auth_provider = self._auth(self.credentials)