summaryrefslogtreecommitdiff
path: root/tests/unittests
diff options
context:
space:
mode:
authorChristian Ehrhardt <christian.ehrhardt@canonical.com>2016-06-07 10:55:14 +0200
committerChristian Ehrhardt <christian.ehrhardt@canonical.com>2016-06-07 10:55:14 +0200
commitcea03ed6bc71d9efe77f296662817d766458e3ac (patch)
tree46adcf97302d817c53f43c072138e8305e109b28 /tests/unittests
parentea26f0adcd24c4cb3b00064a2bd8691acda5ae8a (diff)
downloadvyos-cloud-init-cea03ed6bc71d9efe77f296662817d766458e3ac.tar.gz
vyos-cloud-init-cea03ed6bc71d9efe77f296662817d766458e3ac.zip
mock get_primary_arch for TestAptSourceConfigSourceList for CentOS
This allows the unittest to pass on CentOS, before it failed as it had no dpkg available.
Diffstat (limited to 'tests/unittests')
-rw-r--r--tests/unittests/test_handler/test_handler_apt_configure_sources_list.py10
1 files changed, 6 insertions, 4 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 6e123af7..c3043b14 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
@@ -38,6 +38,8 @@ from cloudinit import util
from cloudinit.config import cc_apt_configure
from cloudinit.sources import DataSourceNone
+from cloudinit.distros.debian import Distro
+
from .. import helpers as t_help
LOG = logging.getLogger(__name__)
@@ -87,8 +89,6 @@ 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
@@ -180,8 +180,10 @@ class TestAptSourceConfigSourceList(t_help.FilesystemMockingTestCase):
with mock.patch.object(util, 'subp', self.subp):
with mock.patch.object(cc_apt_configure, 'get_release',
return_value='fakerelease'):
- cc_apt_configure.handle("notimportant", cfg, mycloud,
- LOG, None)
+ with mock.patch.object(Distro, 'get_primary_arch',
+ return_value='amd64'):
+ cc_apt_configure.handle("notimportant", cfg, mycloud,
+ LOG, None)
mockwrite.assert_called_once_with(
'/etc/apt/sources.list',