summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schweikert <rjschwei@suse.com>2018-09-17 11:37:27 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2018-09-17 11:37:27 +0000
commit37078046cb191234982d95ad4876af4ed8f862f4 (patch)
tree8dd6a8f9ebfd038991007dfcbc3ade41006d06a2
parentbb60f61bfcd92465f4076e8d8abbb486cf6bbcf1 (diff)
downloadvyos-cloud-init-37078046cb191234982d95ad4876af4ed8f862f4.tar.gz
vyos-cloud-init-37078046cb191234982d95ad4876af4ed8f862f4.zip
tests: Add mock for util.get_hostname.
At present the host network settings bleed into the test environment causing the test test_handler_apt_source_v3 to fail if the host has a domain setting other then localdomain. LP: #1792799
-rw-r--r--tests/unittests/test_handler/test_handler_apt_source_v3.py3
1 files changed, 2 insertions, 1 deletions
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 a81c67c7..90fe6eed 100644
--- a/tests/unittests/test_handler/test_handler_apt_source_v3.py
+++ b/tests/unittests/test_handler/test_handler_apt_source_v3.py
@@ -949,7 +949,8 @@ deb http://ubuntu.com/ubuntu/ xenial-proposed main""")
self.assertEqual(
orig, cc_apt_configure.disable_suites(["proposed"], orig, rel))
- def test_apt_v3_mirror_search_dns(self):
+ @mock.patch("cloudinit.util.get_hostname", return_value='abc.localdomain')
+ def test_apt_v3_mirror_search_dns(self, m_get_hostname):
"""test_apt_v3_mirror_search_dns - Test searching dns patterns"""
pmir = "phit"
smir = "shit"