Do not allow libcloud to be injected as a mock value in the libcloud_dns_test

Other tests rely on importing libcloud, which should
not be a mock value.
This commit is contained in:
rallytime 2016-12-05 16:55:18 -07:00
parent 74a417e527
commit d513a60189
2 changed files with 8 additions and 3 deletions

View file

@ -35,7 +35,10 @@ def hasDependency(module, fake_module=None):
:type module: ``str``
:param fake_module: The module to inject into sys.modules
if not provided, a mock will be injected
if not provided, a mock will be injected. If ``False``
is passed explicitly, the module injection does not
occur.
:type fake_module: ``object``
..
@ -45,7 +48,9 @@ def hasDependency(module, fake_module=None):
import sys
if fake_module is None:
fake_module = mock.MagicMock()
sys.modules[module] = fake_module
if fake_module:
sys.modules[module] = fake_module
class MockLoader(object):

View file

@ -39,7 +39,7 @@ def get_mock_driver():
MagicMock(return_value=MockDNSDriver()))
class LibcloudDnsModuleTestCase(ModuleTestCase):
def setUp(self):
hasDependency('libcloud')
hasDependency('libcloud', fake_module=False)
def get_config(service):
if service == SERVICE_NAME: