summaryrefslogtreecommitdiff
path: root/tests/unittests/test_distros
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2015-07-30 15:18:53 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2015-07-30 15:18:53 -0700
commit2fd22530737468a00bfb58eed9b6e231aa6d6652 (patch)
tree8c4a4ab45b875dcfdd473dc61fa173c91a5673f4 /tests/unittests/test_distros
parent55472eb02eaa5b88676a96e006f6838020f8ffe3 (diff)
downloadvyos-cloud-init-2fd22530737468a00bfb58eed9b6e231aa6d6652.tar.gz
vyos-cloud-init-2fd22530737468a00bfb58eed9b6e231aa6d6652.zip
Ensure that when a resolve conf object is written we pass the str() version of it
Instead of passing the raw object and expecting the write_file to work automatically make sure we explicitly pass the string version of it so that the write_file routine can correctly encode/decode it as needed. LP: #1479988
Diffstat (limited to 'tests/unittests/test_distros')
-rw-r--r--tests/unittests/test_distros/test_resolv.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/unittests/test_distros/test_resolv.py b/tests/unittests/test_distros/test_resolv.py
index faaf5b7f..9edeb6e7 100644
--- a/tests/unittests/test_distros/test_resolv.py
+++ b/tests/unittests/test_distros/test_resolv.py
@@ -1,6 +1,8 @@
from cloudinit.distros.parsers import resolv_conf
+from cloudinit.distros import rhel_util
import re
+import tempfile
from ..helpers import TestCase
@@ -19,6 +21,10 @@ class TestResolvHelper(TestCase):
rp_r = str(rp).strip()
self.assertEquals(BASE_RESOLVE, rp_r)
+ def test_write_works(self):
+ with tempfile.NamedTemporaryFile() as fh:
+ rhel_util.update_resolve_conf_file(fh.name, [], [])
+
def test_local_domain(self):
rp = resolv_conf.ResolvConf(BASE_RESOLVE)
self.assertEquals(None, rp.local_domain)