update test suite to match new code

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2011-10-11 16:31:43 +02:00
parent a692e551c0
commit 8ef0c18da0

View file

@ -49,32 +49,35 @@ class Exec(unittest.TestCase):
false_fd.writelines(["#!/bin/sh\n", "/bin/false"])
false_fd.close()
target_host = "does.not.exist"
remote_exec = "ssh -o User=root -q"
remote_copy = "scp -o User=root -q"
self.wrapper = cdist.exec.Wrapper(target_host, remote_exec, remote_copy)
def tearDown(self):
shutil.rmtree(self.temp_dir)
def test_local_success_shell(self):
try:
cdist.exec.shell_run_or_debug_fail(self.shell_true, [self.shell_true])
self.wrapper.shell_run_or_debug_fail(self.shell_true, [self.shell_true])
except cdist.Error:
failed = True
else:
failed = False
self.assertFalse(failed)
def test_local_fail_shell(self):
self.assertRaises(cdist.Error, cdist.exec.shell_run_or_debug_fail,
self.assertRaises(cdist.Error, self.wrapper.shell_run_or_debug_fail,
self.shell_false, [self.shell_false])
def test_local_success(self):
try:
cdist.exec.run_or_fail(["/bin/true"])
self.wrapper.run_or_fail(["/bin/true"])
except cdist.Error:
failed = True
else:
failed = False
self.assertFalse(failed)
def test_local_fail(self):
self.assertRaises(cdist.Error, cdist.exec.run_or_fail, ["/bin/false"])
self.assertRaises(cdist.Error, self.wrapper.run_or_fail, ["/bin/false"])