diff options
author | Vlastimil Holer <vlastimil.holer@gmail.com> | 2013-09-11 00:19:50 +0200 |
---|---|---|
committer | Vlastimil Holer <vlastimil.holer@gmail.com> | 2013-09-11 00:19:50 +0200 |
commit | 1d0c83bd64e3ff24d9b4e722f7aa1a9e108fb943 (patch) | |
tree | 50daaed5a66f6404f9511e92df0027e00ec3f826 /tests/unittests/test_datasource/test_opennebula.py | |
parent | c0d1a59d96a16c080ad8b8278251294cccc21894 (diff) | |
parent | 7dff14c285d6562b9cd0b47876628607feac4a18 (diff) | |
download | vyos-cloud-init-1d0c83bd64e3ff24d9b4e722f7aa1a9e108fb943.tar.gz vyos-cloud-init-1d0c83bd64e3ff24d9b4e722f7aa1a9e108fb943.zip |
Merged lp:~smoser/cloud-init/opennebula
Diffstat (limited to 'tests/unittests/test_datasource/test_opennebula.py')
-rw-r--r-- | tests/unittests/test_datasource/test_opennebula.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/unittests/test_datasource/test_opennebula.py b/tests/unittests/test_datasource/test_opennebula.py index f2457657..9c7a644a 100644 --- a/tests/unittests/test_datasource/test_opennebula.py +++ b/tests/unittests/test_datasource/test_opennebula.py @@ -37,6 +37,7 @@ CMD_IP_OUT = '''\ class TestOpenNebulaDataSource(MockerTestCase): + parsed_user = None def setUp(self): super(TestOpenNebulaDataSource, self).setUp() @@ -48,6 +49,18 @@ class TestOpenNebulaDataSource(MockerTestCase): self.seed_dir = os.path.join(self.paths.seed_dir, "opennebula") self.sys_cfg = {'datasource': {'OpenNebula': {'dsmode': 'local'}}} + # we don't want 'sudo' called in tests. so we patch switch_user_cmd + def my_switch_user_cmd(user): + self.parsed_user = user + return [] + + self.switch_user_cmd_real = ds.switch_user_cmd + ds.switch_user_cmd = my_switch_user_cmd + + def tearDown(self): + ds.switch_user_cmd = self.switch_user_cmd_real + super(TestOpenNebulaDataSource, self).tearDown() + def test_get_data_non_contextdisk(self): try: # dont' try to lookup for CDs @@ -96,9 +109,9 @@ class TestOpenNebulaDataSource(MockerTestCase): util.find_devs_with = orig_find_devs_with def test_get_data(self): + orig_find_devs_with = util.find_devs_with try: # dont' try to lookup for CDs - orig_find_devs_with = util.find_devs_with util.find_devs_with = lambda n: [] populate_context_dir(self.seed_dir, {'KEY1': 'val1'}) dsrc = self.ds(sys_cfg=self.sys_cfg, distro=None, paths=self.paths) |