summaryrefslogtreecommitdiff
path: root/tests/unittests
diff options
context:
space:
mode:
authorChristian Ehrhardt <christian.ehrhardt@canonical.com>2016-05-11 16:59:15 +0200
committerChristian Ehrhardt <christian.ehrhardt@canonical.com>2016-05-11 16:59:15 +0200
commitd5bc051cdc418efa0a910f8b61790523b89e8f91 (patch)
tree12b6104f9df728bb4710f718863cd8b780c32df4 /tests/unittests
parentb4f76a0a855d792acc05807a3a62cc8c72d80792 (diff)
downloadvyos-cloud-init-d5bc051cdc418efa0a910f8b61790523b89e8f91.tar.gz
vyos-cloud-init-d5bc051cdc418efa0a910f8b61790523b89e8f91.zip
add test_apt_source_keyidonly (not yet supported)
Diffstat (limited to 'tests/unittests')
-rw-r--r--tests/unittests/test_handler/test_handler_apt_source.py17
1 files changed, 17 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 091b07da..de009174 100644
--- a/tests/unittests/test_handler/test_handler_apt_source.py
+++ b/tests/unittests/test_handler/test_handler_apt_source.py
@@ -178,6 +178,23 @@ class TestAptSourceConfig(TestCase):
# filename should be ignored on key only
self.assertFalse(os.path.isfile(self.aptlistfile))
+ def test_apt_source_keyidonly(self):
+ """ test_apt_source_keyidonly
+ Test specification of a keyid without source (not yet supported)
+ """
+ params = self._get_default_params()
+ cfg = {'keyid': "03683F77",
+ 'filename': self.aptlistfile}
+
+ with mock.patch.object(util, 'subp',
+ return_value=('fakekey 1212', '')) as mockobj:
+ cc_apt_configure.add_sources([cfg], params)
+
+ mockobj.assert_called_with(('apt-key', 'add', '-'), 'fakekey 1212')
+
+ # filename should be ignored on key only
+ self.assertFalse(os.path.isfile(self.aptlistfile))
+
def test_apt_source_ppa(self):
""" test_apt_source_ppa
Test specification of a ppa