update test suite to match new code
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
parent
a692e551c0
commit
8ef0c18da0
1 changed files with 9 additions and 6 deletions
|
@ -49,32 +49,35 @@ class Exec(unittest.TestCase):
|
||||||
false_fd.writelines(["#!/bin/sh\n", "/bin/false"])
|
false_fd.writelines(["#!/bin/sh\n", "/bin/false"])
|
||||||
false_fd.close()
|
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):
|
def tearDown(self):
|
||||||
shutil.rmtree(self.temp_dir)
|
shutil.rmtree(self.temp_dir)
|
||||||
|
|
||||||
def test_local_success_shell(self):
|
def test_local_success_shell(self):
|
||||||
try:
|
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:
|
except cdist.Error:
|
||||||
failed = True
|
failed = True
|
||||||
else:
|
else:
|
||||||
failed = False
|
failed = False
|
||||||
|
|
||||||
self.assertFalse(failed)
|
self.assertFalse(failed)
|
||||||
|
|
||||||
def test_local_fail_shell(self):
|
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])
|
self.shell_false, [self.shell_false])
|
||||||
|
|
||||||
def test_local_success(self):
|
def test_local_success(self):
|
||||||
try:
|
try:
|
||||||
cdist.exec.run_or_fail(["/bin/true"])
|
self.wrapper.run_or_fail(["/bin/true"])
|
||||||
except cdist.Error:
|
except cdist.Error:
|
||||||
failed = True
|
failed = True
|
||||||
else:
|
else:
|
||||||
failed = False
|
failed = False
|
||||||
|
|
||||||
self.assertFalse(failed)
|
self.assertFalse(failed)
|
||||||
|
|
||||||
def test_local_fail(self):
|
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"])
|
||||||
|
|
Loading…
Reference in a new issue