summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNate House nathan.house@rackspace.com <>2014-02-04 16:09:09 -0600
committerNate House nathan.house@rackspace.com <>2014-02-04 16:09:09 -0600
commit6e0aaf44c7a869d35a962a2d60be2d833023d4ec (patch)
tree2cf2bf8727e389c53e25190becb2ba44ac2ffd9d /tests
parent6922fc8294e38ee0780e9d74da7d3ec010a3cd3c (diff)
parent0efeb26736ddae2967c14a9440088594da32070d (diff)
downloadvyos-cloud-init-6e0aaf44c7a869d35a962a2d60be2d833023d4ec.tar.gz
vyos-cloud-init-6e0aaf44c7a869d35a962a2d60be2d833023d4ec.zip
Merge gentoo branch and updated set-password to support systemctl
Diffstat (limited to 'tests')
-rw-r--r--tests/unittests/test_distros/test_is_excluded.py15
-rw-r--r--tests/unittests/test_handler/test_handler_yum_add_repo.py7
2 files changed, 20 insertions, 2 deletions
diff --git a/tests/unittests/test_distros/test_is_excluded.py b/tests/unittests/test_distros/test_is_excluded.py
new file mode 100644
index 00000000..53a4445c
--- /dev/null
+++ b/tests/unittests/test_distros/test_is_excluded.py
@@ -0,0 +1,15 @@
+from cloudinit.distros import gentoo
+import unittest
+
+
+class TestIsExcluded(unittest.TestCase):
+
+ def setUp(self):
+ self.distro = gentoo.Distro('gentoo', {}, None)
+ self.distro.exclude_modules = ['test-module']
+
+ def test_is_excluded_success(self):
+ self.assertEqual(self.distro.is_excluded('test-module'), True)
+
+ def test_is_excluded_fail(self):
+ self.assertEqual(self.distro.is_excluded('missing'), None)
diff --git a/tests/unittests/test_handler/test_handler_yum_add_repo.py b/tests/unittests/test_handler/test_handler_yum_add_repo.py
index 8df592f9..ddf0ef9c 100644
--- a/tests/unittests/test_handler/test_handler_yum_add_repo.py
+++ b/tests/unittests/test_handler/test_handler_yum_add_repo.py
@@ -2,6 +2,7 @@ from cloudinit import helpers
from cloudinit import util
from cloudinit.config import cc_yum_add_repo
+from cloudinit.distros import rhel
from tests.unittests import helpers
@@ -18,6 +19,8 @@ class TestConfig(helpers.FilesystemMockingTestCase):
def setUp(self):
super(TestConfig, self).setUp()
self.tmp = self.makeDir(prefix="unittest_")
+ self.cloud = type('', (), {})()
+ self.cloud.distro = rhel.Distro('test', {}, None)
def test_bad_config(self):
cfg = {
@@ -34,7 +37,7 @@ class TestConfig(helpers.FilesystemMockingTestCase):
},
}
self.patchUtils(self.tmp)
- cc_yum_add_repo.handle('yum_add_repo', cfg, None, LOG, [])
+ cc_yum_add_repo.handle('yum_add_repo', cfg, self.cloud, LOG, [])
self.assertRaises(IOError, util.load_file,
"/etc/yum.repos.d/epel_testing.repo")
@@ -52,7 +55,7 @@ class TestConfig(helpers.FilesystemMockingTestCase):
},
}
self.patchUtils(self.tmp)
- cc_yum_add_repo.handle('yum_add_repo', cfg, None, LOG, [])
+ cc_yum_add_repo.handle('yum_add_repo', cfg, self.cloud, LOG, [])
contents = util.load_file("/etc/yum.repos.d/epel_testing.repo")
contents = configobj.ConfigObj(StringIO(contents))
expected = {