summaryrefslogtreecommitdiff
path: root/tests/unittests/test_distros/test_netconfig.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2014-10-10 18:54:28 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2014-10-10 18:54:28 -0700
commit36bc6de57a2c9be1efe9ae7e9ebaf7fa9023d230 (patch)
tree8d18c8736f892b0bc57cee3a2934b572dd385d8b /tests/unittests/test_distros/test_netconfig.py
parent797de394e5395f39b7f17403999e25cbe7f7a126 (diff)
downloadvyos-cloud-init-36bc6de57a2c9be1efe9ae7e9ebaf7fa9023d230.tar.gz
vyos-cloud-init-36bc6de57a2c9be1efe9ae7e9ebaf7fa9023d230.zip
Fix some of the erroring out test cases
There are a couple new test cases that are now erroring out. - A usage of the non helper unit testcase base which is trigging and error on python 2.6 due to lack of method, fix this by using the base helper class. - A freebsd distro test check thats looking for /etc/resolv.conf and examining its contents, which won't exist due to our mocking routine that does not allow that file to be read. - A freebsd distro test where the distro class tries to call into ['ifconfig', '-a'] for a set of values, those values don't exist on the machine I am running on (and likely others machines) so we should mock the subp function out (that the distro class calls) and correctly return values that will work for the testcase.
Diffstat (limited to 'tests/unittests/test_distros/test_netconfig.py')
-rw-r--r--tests/unittests/test_distros/test_netconfig.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/unittests/test_distros/test_netconfig.py b/tests/unittests/test_distros/test_netconfig.py
index fbdb7b3f..35cc1f43 100644
--- a/tests/unittests/test_distros/test_netconfig.py
+++ b/tests/unittests/test_distros/test_netconfig.py
@@ -182,6 +182,12 @@ NETWORKING=yes
spec=False, passthrough=False)
load_mock = self.mocker.replace(util.load_file,
spec=False, passthrough=False)
+ subp_mock = self.mocker.replace(util.subp,
+ spec=False, passthrough=False)
+
+ subp_mock(['ifconfig', '-a'])
+ self.mocker.count(0, None)
+ self.mocker.result(('vtnet0', ''))
exists_mock(mocker.ARGS)
self.mocker.count(0, None)
@@ -190,6 +196,7 @@ NETWORKING=yes
write_bufs = {}
read_bufs = {
'/etc/rc.conf': '',
+ '/etc/resolv.conf': '',
}
def replace_write(filename, content, mode=0644, omode="wb"):