Signed-off-by: Lucio Correia <luciojhc(a)linux.vnet.ibm.com>
---
tests/test_model.py | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/tests/test_model.py b/tests/test_model.py
index e1b957c..64085a0 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -86,8 +86,28 @@ NON_NUMA_XML = """
</features>
</domain>"""
+net_validate_patch = None
+net_validate = None
+
def setUpModule():
+ global net_validate_patch
+ global net_validate
+
+ # mock default networks
+ config = {'method.return_value': True}
+ net_validate_patch = mock.patch('wok.plugins.kimchi.model.templates.'
+ 'LibvirtVMTemplate._network_validate',
+ **config)
+ net_validate = net_validate_patch.start()
+
+ # mock osinfo defaults
+ osinfo.defaults['networks'] = []
+ osinfo.DEFAULT_POOLS = {
+ 'default': DEFAULT_DIR,
+ 'ISO': ISO_DIR,
+ }
+
print __file__, "creating pools at", BASE_DIR
os.makedirs(DEFAULT_DIR)
os.makedirs(ISO_DIR)
@@ -105,6 +125,9 @@ def setUpModule():
def tearDownModule():
+ global net_validate_patch
+ net_validate_patch.stop()
+
# Model will create default and ISO storagepools at /var/tmp: delete them.
conn = libvirt.open('qemu:///session')
--
2.7.4