diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2012-03-05 03:39:57 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2012-03-05 03:39:57 +0100 |
commit | f3f6b8eafa07b8d9e815e023adb8825ce89ef8da (patch) | |
tree | 10650e539e9a5840cda105f51069a68b70b415ac /selftest/tests | |
parent | d6924f803904d25a7f9cac2ec69f421d7a5bdeab (diff) | |
download | samba-f3f6b8eafa07b8d9e815e023adb8825ce89ef8da.tar.gz samba-f3f6b8eafa07b8d9e815e023adb8825ce89ef8da.tar.bz2 samba-f3f6b8eafa07b8d9e815e023adb8825ce89ef8da.zip |
selftest.run: Factor out expand_command_run.
Diffstat (limited to 'selftest/tests')
-rw-r--r-- | selftest/tests/test_run.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/selftest/tests/test_run.py b/selftest/tests/test_run.py index f7a1dda436..f1ce4bc9de 100644 --- a/selftest/tests/test_run.py +++ b/selftest/tests/test_run.py @@ -19,9 +19,12 @@ """Tests for selftest.run.""" +import os + from selftest.run import ( expand_command_list, expand_environment_strings, + expand_command_run, ) from selftest.tests import TestCase @@ -48,3 +51,29 @@ class ExpandCommandListTests(TestCase): def test_list(self): self.assertEquals("test --list", expand_command_list("test $LISTOPT")) + + +class ExpandCommandRunTests(TestCase): + + def test_idlist(self): + self.assertEquals(("test foo bar", None), + expand_command_run("test", False, True, subtests=["foo", "bar"])) + + def test_idlist_all(self): + self.assertEquals(("test", None), + expand_command_run("test", False, True)) + + def test_loadlist(self): + (cmd, tmpf) = expand_command_run("test $LOADLIST", True, False, + subtests=["foo", "bar"]) + self.addCleanup(os.remove, tmpf) + f = open(tmpf, 'r') + try: + self.assertEquals(f.read(), "foo\nbar\n") + finally: + f.close() + self.assertEquals("test --load-list=%s" % tmpf, cmd) + + def test_loadlist_all(self): + self.assertEquals(("test ", None), + expand_command_run("test $LOADLIST", True, False)) |