mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
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:
parent
74a417e527
commit
d513a60189
2 changed files with 8 additions and 3 deletions
|
@ -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):
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue