summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHarm Weites <harm@weites.com>2014-08-28 17:50:24 +0000
committerHarm Weites <harm@weites.com>2014-08-28 17:50:24 +0000
commit5fbdb88b843bfa3b5fb2c454219779b9889cf787 (patch)
treecbcbefde68e9c1347ae3ae45dd2694bdb94e970a /tests
parent1b9b66be04aafcb39f349ccb48905afc393cfc32 (diff)
downloadvyos-cloud-init-5fbdb88b843bfa3b5fb2c454219779b9889cf787.tar.gz
vyos-cloud-init-5fbdb88b843bfa3b5fb2c454219779b9889cf787.zip
fix: Make sure this freebsd test succeeds on all platforms (harlowja).
Diffstat (limited to 'tests')
-rw-r--r--tests/unittests/test_distros/test_netconfig.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/unittests/test_distros/test_netconfig.py b/tests/unittests/test_distros/test_netconfig.py
index 96379025..ed997a1d 100644
--- a/tests/unittests/test_distros/test_netconfig.py
+++ b/tests/unittests/test_distros/test_netconfig.py
@@ -180,12 +180,17 @@ NETWORKING=yes
spec=False, passthrough=False)
exists_mock = self.mocker.replace(os.path.isfile,
spec=False, passthrough=False)
+ load_mock = self.mocker.replace(util.load_file,
+ spec=False, passthrough=False)
exists_mock(mocker.ARGS)
self.mocker.count(0, None)
self.mocker.result(False)
write_bufs = {}
+ read_bufs = {
+ '/etc/rc.conf': '',
+ }
def replace_write(filename, content, mode=0644, omode="wb"):
buf = WriteBuffer()
@@ -194,8 +199,24 @@ NETWORKING=yes
buf.write(content)
write_bufs[filename] = buf
+ def replace_read(fname, read_cb=None, quiet=False):
+ if fname not in read_bufs:
+ if fname in write_bufs:
+ return str(write_bufs[fname])
+ raise IOError("%s not found" % fname)
+ else:
+ if fname in write_bufs:
+ return str(write_bufs[fname])
+ return read_bufs[fname]
+
util_mock(mocker.ARGS)
self.mocker.call(replace_write)
+ self.mocker.count(0, None)
+
+ load_mock(mocker.ARGS)
+ self.mocker.call(replace_read)
+ self.mocker.count(0, None)
+
self.mocker.replay()
fbsd_distro.apply_network(BASE_NET_CFG, False)