summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristian Ehrhardt <christian.ehrhardt@canonical.com>2016-05-23 08:21:59 +0200
committerChristian Ehrhardt <christian.ehrhardt@canonical.com>2016-05-23 08:21:59 +0200
commit8575c4f7045c7074370bba73198ea36571224ece (patch)
treeb6db09c747b3c7bed03e667e7d8a729192f9e3aa /tests
parent454de24c7d457b980c91849b128efe4faee62032 (diff)
downloadvyos-cloud-init-8575c4f7045c7074370bba73198ea36571224ece.tar.gz
vyos-cloud-init-8575c4f7045c7074370bba73198ea36571224ece.zip
generalize test_apt_source_basic to be reusable across more testcases
Diffstat (limited to 'tests')
-rw-r--r--tests/unittests/test_handler/test_handler_apt_source.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/tests/unittests/test_handler/test_handler_apt_source.py b/tests/unittests/test_handler/test_handler_apt_source.py
index e130392c..1b294431 100644
--- a/tests/unittests/test_handler/test_handler_apt_source.py
+++ b/tests/unittests/test_handler/test_handler_apt_source.py
@@ -58,27 +58,34 @@ class TestAptSourceConfig(TestCase):
params['MIRROR'] = "http://archive.ubuntu.com/ubuntu"
return params
- def test_apt_source_basic(self):
- """ test_apt_source_basic
+ def apt_source_basic(self, filename, cfg):
+ """ apt_source_basic
Test Fix deb source string, has to overwrite mirror conf in params
"""
params = self._get_default_params()
- cfg = {'source': ('deb http://archive.ubuntu.com/ubuntu'
- ' karmic-backports'
- ' main universe multiverse restricted'),
- 'filename': self.aptlistfile}
cc_apt_configure.add_sources([cfg], params)
- self.assertTrue(os.path.isfile(self.aptlistfile))
+ self.assertTrue(os.path.isfile(filename))
- contents = load_tfile_or_url(self.aptlistfile)
+ contents = load_tfile_or_url(filename)
self.assertTrue(re.search(r"%s %s %s %s\n" %
("deb", "http://archive.ubuntu.com/ubuntu",
"karmic-backports",
"main universe multiverse restricted"),
contents, flags=re.IGNORECASE))
+ def test_apt_source_basic(self):
+ """ test_apt_source_basic
+ Test Fix deb source string, has to overwrite mirror conf in params.
+ Test with a filename provided in config.
+ """
+ cfg = {'source': ('deb http://archive.ubuntu.com/ubuntu'
+ ' karmic-backports'
+ ' main universe multiverse restricted'),
+ 'filename': self.aptlistfile}
+ self.apt_source_basic(self.aptlistfile, cfg)
+
def test_apt_source_replacement(self):
""" test_apt_source_replace
Test Autoreplacement of MIRROR and RELEASE in source specs