summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristian Ehrhardt <christian.ehrhardt@canonical.com>2016-05-12 21:20:29 +0200
committerChristian Ehrhardt <christian.ehrhardt@canonical.com>2016-05-12 21:20:29 +0200
commit0a407b63f61f48d310d205f833c1a2792273ec80 (patch)
tree4aa94d3e1d59000f81fea4c02b20730cecf4a8f6 /tests
parent2a54898f8009f1511862a75467e84a77bef1943a (diff)
downloadvyos-cloud-init-0a407b63f61f48d310d205f833c1a2792273ec80.tar.gz
vyos-cloud-init-0a407b63f61f48d310d205f833c1a2792273ec80.zip
streamline code and sanitize expected result string definition
Diffstat (limited to 'tests')
-rw-r--r--tests/unittests/test_handler/test_handler_apt_configure_sources_list.py28
1 files changed, 17 insertions, 11 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 3bcd93cf..1aa4f553 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
@@ -44,6 +44,22 @@ apt_custom_sources_list: |
# FIND_SOMETHING_SPECIAL
"""
+EXPECTED_CONVERTED_CONTENT = (
+ """## Note, this file is written by cloud-init on first boot of an instance
+## modifications made here will not survive a re-bundle.
+## if you wish to make changes you can:
+## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg
+## or do the same in user-data
+## b.) add sources in /etc/apt/sources.list.d
+## c.) make changes to template file /etc/cloud/templates/sources.list.tmpl
+
+# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
+# newer versions of the distribution.
+deb http://archive.ubuntu.com/ubuntu/ xenial main restricted
+deb-src http://archive.ubuntu.com/ubuntu/ xenial main restricted
+# FIND_SOMETHING_SPECIAL
+""")
+
def load_tfile_or_url(*args, **kwargs):
""" load_tfile_or_url
@@ -141,17 +157,7 @@ class TestAptSourceConfigSourceList(t_help.FilesystemMockingTestCase):
mockwrite.assert_called_once_with(
'/etc/apt/sources.list',
- ("## Note, this file is written by cloud-init on first boot of an"
- " instance\n## modifications made here will not survive a re-bun"
- "dle.\n## if you wish to make changes you can:\n## a.) add 'apt_"
- "preserve_sources_list: true' to /etc/cloud/cloud.cfg\n## or"
- " do the same in user-data\n## b.) add sources in /etc/apt/sourc"
- "es.list.d\n## c.) make changes to template file /etc/cloud/temp"
- "lates/sources.list.tmpl\n\n# See http://help.ubuntu.com/communi"
- "ty/UpgradeNotes for how to upgrade to\n# newer versions of the "
- "distribution.\ndeb http://archive.ubuntu.com/ubuntu/ xenial mai"
- "n restricted\ndeb-src http://archive.ubuntu.com/ubuntu/ xenial "
- "main restricted\n# FIND_SOMETHING_SPECIAL\n"),
+ EXPECTED_CONVERTED_CONTENT,
mode=420)