diff options
author | Christian Ehrhardt <christian.ehrhardt@canonical.com> | 2016-05-24 19:07:15 +0200 |
---|---|---|
committer | Christian Ehrhardt <christian.ehrhardt@canonical.com> | 2016-05-24 19:07:15 +0200 |
commit | 150abceed3ec8d1d5099e855ebc4fce0361be65d (patch) | |
tree | 14006ca0941018d96b498df167047fe533212c30 /tests/unittests/test_handler/test_handler_apt_source.py | |
parent | c2cfbd6831912e6dfd6b16ed21afb929592ce51a (diff) | |
download | vyos-cloud-init-150abceed3ec8d1d5099e855ebc4fce0361be65d.tar.gz vyos-cloud-init-150abceed3ec8d1d5099e855ebc4fce0361be65d.zip |
add test for the now isolated convert_to_new_format function
Diffstat (limited to 'tests/unittests/test_handler/test_handler_apt_source.py')
-rw-r--r-- | tests/unittests/test_handler/test_handler_apt_source.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/unittests/test_handler/test_handler_apt_source.py b/tests/unittests/test_handler/test_handler_apt_source.py index c19904fb..1b2bc58f 100644 --- a/tests/unittests/test_handler/test_handler_apt_source.py +++ b/tests/unittests/test_handler/test_handler_apt_source.py @@ -518,4 +518,33 @@ class TestAptSourceConfig(TestCase): self.assertFalse(os.path.isfile(self.aptlistfile2)) self.assertFalse(os.path.isfile(self.aptlistfile3)) + def test_convert_to_new_format(self): + """ test_convert_to_new_format + Test the conversion of old to new format + And the noop conversion of new to new format as well + """ + cfg1 = {'source': 'deb $MIRROR $RELEASE multiverse', + 'filename': self.aptlistfile} + cfg2 = {'source': 'deb $MIRROR $RELEASE main', + 'filename': self.aptlistfile2} + cfg3 = {'source': 'deb $MIRROR $RELEASE universe', + 'filename': self.aptlistfile3} + errorlist = [] + checkcfg = {self.aptlistfile: {'filename': self.aptlistfile, + 'source': 'deb $MIRROR $RELEASE ' + 'multiverse'}, + self.aptlistfile2: {'filename': self.aptlistfile2, + 'source': 'deb $MIRROR $RELEASE main'}, + self.aptlistfile3: {'filename': self.aptlistfile3, + 'source': 'deb $MIRROR $RELEASE ' + 'universe'}} + + newcfg = cc_apt_configure.convert_to_new_format([cfg1, cfg2, cfg3], + errorlist) + self.assertEqual(newcfg, checkcfg) + + newcfg2 = cc_apt_configure.convert_to_new_format(newcfg, errorlist) + self.assertEqual(newcfg2, checkcfg) + + # vi: ts=4 expandtab |