summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorScott Moser <smoser@brickies.net>2016-09-08 09:33:49 -0400
committerScott Moser <smoser@brickies.net>2016-09-08 09:33:49 -0400
commitf242ba437ce814e43e919e647ff0216e182329b8 (patch)
tree7f177f3eb4a1771efcc48fe04424ac91f71b8fa7 /tests
parenta2b25e33dff19ef5d60c9a9292529d25b76fc998 (diff)
parent058dd753b91126a504a82d4a48305e9d56116f73 (diff)
downloadvyos-cloud-init-f242ba437ce814e43e919e647ff0216e182329b8.tar.gz
vyos-cloud-init-f242ba437ce814e43e919e647ff0216e182329b8.zip
merge from master at 0.7.7-26-g058dd75
Diffstat (limited to 'tests')
-rw-r--r--tests/unittests/test_handler/test_handler_apt_conf_v1.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/unittests/test_handler/test_handler_apt_conf_v1.py b/tests/unittests/test_handler/test_handler_apt_conf_v1.py
index 95fd1da2..45714efd 100644
--- a/tests/unittests/test_handler/test_handler_apt_conf_v1.py
+++ b/tests/unittests/test_handler/test_handler_apt_conf_v1.py
@@ -3,6 +3,7 @@ from cloudinit import util
from ..helpers import TestCase
+import copy
import os
import re
import shutil
@@ -106,4 +107,25 @@ class TestAptProxyConfig(TestCase):
self.assertFalse(os.path.isfile(self.cfile))
+class TestConversion(TestCase):
+ def test_convert_with_apt_mirror_as_empty_string(self):
+ # an empty apt_mirror is the same as no apt_mirror
+ empty_m_found = cc_apt_configure.convert_to_v3_apt_format(
+ {'apt_mirror': ''})
+ default_found = cc_apt_configure.convert_to_v3_apt_format({})
+ self.assertEqual(default_found, empty_m_found)
+
+ def test_convert_with_apt_mirror(self):
+ mirror = 'http://my.mirror/ubuntu'
+ f = cc_apt_configure.convert_to_v3_apt_format({'apt_mirror': mirror})
+ self.assertIn(mirror, {m['uri'] for m in f['apt']['primary']})
+
+ def test_no_old_content(self):
+ mirror = 'http://my.mirror/ubuntu'
+ mydata = {'apt': {'primary': {'arches': ['default'], 'uri': mirror}}}
+ expected = copy.deepcopy(mydata)
+ self.assertEqual(expected,
+ cc_apt_configure.convert_to_v3_apt_format(mydata))
+
+
# vi: ts=4 expandtab