summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristian Ehrhardt <christian.ehrhardt@canonical.com>2016-06-06 14:34:45 +0200
committerChristian Ehrhardt <christian.ehrhardt@canonical.com>2016-06-06 14:34:45 +0200
commita3b234357ce1e1c7b8d9411d0928873752e2d107 (patch)
tree0f05a2ca21ae6afd170bd3615e25987d24884c7f /tests
parentc1ad09609805c6c4f5262eb21533799af814379a (diff)
downloadvyos-cloud-init-a3b234357ce1e1c7b8d9411d0928873752e2d107.tar.gz
vyos-cloud-init-a3b234357ce1e1c7b8d9411d0928873752e2d107.zip
only test the apt feature in environments with apt
Diffstat (limited to 'tests')
-rw-r--r--tests/unittests/test_handler/test_handler_apt_configure_sources_list.py4
-rw-r--r--tests/unittests/test_handler/test_handler_apt_source.py5
2 files changed, 9 insertions, 0 deletions
diff --git a/tests/unittests/test_handler/test_handler_apt_configure_sources_list.py b/tests/unittests/test_handler/test_handler_apt_configure_sources_list.py
index 5f1dd427..27e332d5 100644
--- a/tests/unittests/test_handler/test_handler_apt_configure_sources_list.py
+++ b/tests/unittests/test_handler/test_handler_apt_configure_sources_list.py
@@ -24,6 +24,8 @@ from .. import helpers as t_help
LOG = logging.getLogger(__name__)
+BIN_APT = "/usr/bin/apt"
+
YAML_TEXT_CUSTOM_SL = """
apt_mirror: http://archive.ubuntu.com/ubuntu/
apt_custom_sources_list: |
@@ -67,6 +69,8 @@ def load_tfile_or_url(*args, **kwargs):
return util.decode_binary(util.read_file_or_url(*args, **kwargs).contents)
+# This feature is apt specific and thereby is disabled in environments without
+@t_help.skipIf(not os.path.isfile(BIN_APT), "no apt")
class TestAptSourceConfigSourceList(t_help.FilesystemMockingTestCase):
"""TestAptSourceConfigSourceList
Main Class to test sources list rendering
diff --git a/tests/unittests/test_handler/test_handler_apt_source.py b/tests/unittests/test_handler/test_handler_apt_source.py
index 4a720213..223af764 100644
--- a/tests/unittests/test_handler/test_handler_apt_source.py
+++ b/tests/unittests/test_handler/test_handler_apt_source.py
@@ -17,6 +17,9 @@ from cloudinit.config import cc_apt_configure
from cloudinit import util
from ..helpers import TestCase
+from .. import helpers as t_help
+
+BIN_APT = "/usr/bin/apt"
EXPECTEDKEY = """-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1
@@ -40,6 +43,8 @@ def load_tfile_or_url(*args, **kwargs):
return util.decode_binary(util.read_file_or_url(*args, **kwargs).contents)
+# This feature is apt specific and thereby is disabled in environments without
+@t_help.skipIf(not os.path.isfile(BIN_APT), "no apt")
class TestAptSourceConfig(TestCase):
"""TestAptSourceConfig
Main Class to test apt_source configs