summaryrefslogtreecommitdiff
path: root/tests/unittests
diff options
context:
space:
mode:
authorChristian Ehrhardt <christian.ehrhardt@canonical.com>2016-06-06 13:52:31 +0200
committerChristian Ehrhardt <christian.ehrhardt@canonical.com>2016-06-06 13:52:31 +0200
commite9b333b49954d5863f8b53581454179b0363d978 (patch)
tree3380db33ee90c33d628658e37a280687aa40cfe3 /tests/unittests
parent89688593e9358433cd9383d1bdfae12dbcd58f72 (diff)
downloadvyos-cloud-init-e9b333b49954d5863f8b53581454179b0363d978.tar.gz
vyos-cloud-init-e9b333b49954d5863f8b53581454179b0363d978.zip
fixup key tests for cases where network isn't available
Diffstat (limited to 'tests/unittests')
-rw-r--r--tests/unittests/test_handler/test_handler_apt_source.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/tests/unittests/test_handler/test_handler_apt_source.py b/tests/unittests/test_handler/test_handler_apt_source.py
index 65e375a0..c7eeb64c 100644
--- a/tests/unittests/test_handler/test_handler_apt_source.py
+++ b/tests/unittests/test_handler/test_handler_apt_source.py
@@ -452,13 +452,11 @@ class TestAptSourceConfig(TestCase):
"""
params = self._get_default_params()
- def fake_gpg_recv_key(self, key, keyserver):
+ def fake_gpg_recv_key(key, keyserver):
"""try original gpg_recv_key, but allow fall back"""
try:
- print("Try orig orig_gpg_recv_key")
self.orig_gpg_recv_key(key, keyserver)
- except ValueError:
- print("Fail, test net")
+ except ValueError as error:
# if this is a networking issue mock it's effect
testsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
@@ -466,10 +464,8 @@ class TestAptSourceConfig(TestCase):
testsock.close()
except socket.error:
# as fallback add the known key as a working recv would
- print("Fallback import expectedkey")
util.subp(("gpg", "--import", "-"), EXPECTEDKEY)
- print("FOO")
with mock.patch.object(cc_apt_configure, 'add_key_raw') as mockkey:
with mock.patch.object(util, 'gpg_recv_key',
side_effect=fake_gpg_recv_key) as mockrecv: