summaryrefslogtreecommitdiff
path: root/tests/unittests
diff options
context:
space:
mode:
authorDaniel Watkins <oddbloke@ubuntu.com>2020-01-16 13:30:12 -0500
committerRyan Harper <ryan.harper@canonical.com>2020-01-16 12:30:12 -0600
commit651e24066ba4b9464c7843553f60d17a459cf06e (patch)
treeb4bae771e62bf725b7d568efb9741f2be88a915c /tests/unittests
parent259d9c501472315e539701f00095743390eb89e5 (diff)
downloadvyos-cloud-init-651e24066ba4b9464c7843553f60d17a459cf06e.tar.gz
vyos-cloud-init-651e24066ba4b9464c7843553f60d17a459cf06e.zip
util: rename get_architecture to get_dpkg_architecture (#173)
This makes it clearer that we should only use this in code paths that will definitely have dpkg available to them. - Rename get_architecture -> get_dpkg_architecture - Add docstring to get_dpkg_architecture
Diffstat (limited to 'tests/unittests')
-rw-r--r--tests/unittests/test_handler/test_handler_apt_configure_sources_list_v1.py2
-rw-r--r--tests/unittests/test_handler/test_handler_apt_configure_sources_list_v3.py2
-rw-r--r--tests/unittests/test_handler/test_handler_apt_source_v1.py2
-rw-r--r--tests/unittests/test_handler/test_handler_apt_source_v3.py20
4 files changed, 14 insertions, 12 deletions
diff --git a/tests/unittests/test_handler/test_handler_apt_configure_sources_list_v1.py b/tests/unittests/test_handler/test_handler_apt_configure_sources_list_v1.py
index 23bd6e10..7c17a264 100644
--- a/tests/unittests/test_handler/test_handler_apt_configure_sources_list_v1.py
+++ b/tests/unittests/test_handler/test_handler_apt_configure_sources_list_v1.py
@@ -78,7 +78,7 @@ class TestAptSourceConfigSourceList(t_help.FilesystemMockingTestCase):
get_rel = rpatcher.start()
get_rel.return_value = {'codename': "fakerelease"}
self.addCleanup(rpatcher.stop)
- apatcher = mock.patch("cloudinit.util.get_architecture")
+ apatcher = mock.patch("cloudinit.util.get_dpkg_architecture")
get_arch = apatcher.start()
get_arch.return_value = 'amd64'
self.addCleanup(apatcher.stop)
diff --git a/tests/unittests/test_handler/test_handler_apt_configure_sources_list_v3.py b/tests/unittests/test_handler/test_handler_apt_configure_sources_list_v3.py
index f7608c28..0a68cb8f 100644
--- a/tests/unittests/test_handler/test_handler_apt_configure_sources_list_v3.py
+++ b/tests/unittests/test_handler/test_handler_apt_configure_sources_list_v3.py
@@ -106,7 +106,7 @@ class TestAptSourceConfigSourceList(t_help.FilesystemMockingTestCase):
get_rel = rpatcher.start()
get_rel.return_value = {'codename': "fakerel"}
self.addCleanup(rpatcher.stop)
- apatcher = mock.patch("cloudinit.util.get_architecture")
+ apatcher = mock.patch("cloudinit.util.get_dpkg_architecture")
get_arch = apatcher.start()
get_arch.return_value = 'amd64'
self.addCleanup(apatcher.stop)
diff --git a/tests/unittests/test_handler/test_handler_apt_source_v1.py b/tests/unittests/test_handler/test_handler_apt_source_v1.py
index a3132fbd..652d97ab 100644
--- a/tests/unittests/test_handler/test_handler_apt_source_v1.py
+++ b/tests/unittests/test_handler/test_handler_apt_source_v1.py
@@ -77,7 +77,7 @@ class TestAptSourceConfig(TestCase):
get_rel = rpatcher.start()
get_rel.return_value = {'codename': self.release}
self.addCleanup(rpatcher.stop)
- apatcher = mock.patch("cloudinit.util.get_architecture")
+ apatcher = mock.patch("cloudinit.util.get_dpkg_architecture")
get_arch = apatcher.start()
get_arch.return_value = 'amd64'
self.addCleanup(apatcher.stop)
diff --git a/tests/unittests/test_handler/test_handler_apt_source_v3.py b/tests/unittests/test_handler/test_handler_apt_source_v3.py
index dcffbe13..c5cf6785 100644
--- a/tests/unittests/test_handler/test_handler_apt_source_v3.py
+++ b/tests/unittests/test_handler/test_handler_apt_source_v3.py
@@ -453,14 +453,14 @@ class TestAptSourceConfig(t_help.FilesystemMockingTestCase):
self.assertFalse(os.path.isfile(self.aptlistfile2))
self.assertFalse(os.path.isfile(self.aptlistfile3))
- @mock.patch("cloudinit.config.cc_apt_configure.util.get_architecture")
- def test_apt_v3_list_rename(self, m_get_architecture):
+ @mock.patch("cloudinit.config.cc_apt_configure.util.get_dpkg_architecture")
+ def test_apt_v3_list_rename(self, m_get_dpkg_architecture):
"""test_apt_v3_list_rename - Test find mirror and apt list renaming"""
pre = "/var/lib/apt/lists"
# filenames are archive dependent
arch = 's390x'
- m_get_architecture.return_value = arch
+ m_get_dpkg_architecture.return_value = arch
component = "ubuntu-ports"
archive = "ports.ubuntu.com"
@@ -491,13 +491,13 @@ class TestAptSourceConfig(t_help.FilesystemMockingTestCase):
mockren.assert_any_call(fromfn, tofn)
- @mock.patch("cloudinit.config.cc_apt_configure.util.get_architecture")
- def test_apt_v3_list_rename_non_slash(self, m_get_architecture):
+ @mock.patch("cloudinit.config.cc_apt_configure.util.get_dpkg_architecture")
+ def test_apt_v3_list_rename_non_slash(self, m_get_dpkg_architecture):
target = os.path.join(self.tmp, "rename_non_slash")
apt_lists_d = os.path.join(target, "./" + cc_apt_configure.APT_LISTS)
arch = 'amd64'
- m_get_architecture.return_value = arch
+ m_get_dpkg_architecture.return_value = arch
mirror_path = "some/random/path/"
primary = "http://test.ubuntu.com/" + mirror_path
@@ -626,10 +626,12 @@ class TestAptSourceConfig(t_help.FilesystemMockingTestCase):
self.assertEqual(mirrors['SECURITY'],
smir)
- @mock.patch("cloudinit.config.cc_apt_configure.util.get_architecture")
- def test_apt_v3_get_def_mir_non_intel_no_arch(self, m_get_architecture):
+ @mock.patch("cloudinit.config.cc_apt_configure.util.get_dpkg_architecture")
+ def test_apt_v3_get_def_mir_non_intel_no_arch(
+ self, m_get_dpkg_architecture
+ ):
arch = 'ppc64el'
- m_get_architecture.return_value = arch
+ m_get_dpkg_architecture.return_value = arch
expected = {'PRIMARY': 'http://ports.ubuntu.com/ubuntu-ports',
'SECURITY': 'http://ports.ubuntu.com/ubuntu-ports'}
self.assertEqual(expected, cc_apt_configure.get_default_mirrors())