f7a1dda436807771ad3a7096aa5b2231b86ed3d4
[ira/wip.git] / selftest / tests / test_run.py
1 # test_run.py -- Tests for selftest.run
2 # Copyright (C) 2012 Jelmer Vernooij <jelmer@samba.org>
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; version 3
7 # of the License or (at your option) any later version of
8 # the License.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 # MA  02110-1301, USA.
19
20 """Tests for selftest.run."""
21
22 from selftest.run import (
23     expand_command_list,
24     expand_environment_strings,
25     )
26
27 from selftest.tests import TestCase
28
29
30 class ExpandEnvironmentStringsTests(TestCase):
31
32     def test_no_vars(self):
33         self.assertEquals("foo bar", expand_environment_strings("foo bar", {}))
34
35     def test_simple(self):
36         self.assertEquals("foo bar",
37             expand_environment_strings("foo $BLA", {"BLA": "bar"}))
38
39     def test_unknown(self):
40         self.assertEquals("foo $BLA",
41             expand_environment_strings("foo $BLA", {}))
42
43
44 class ExpandCommandListTests(TestCase):
45
46     def test_no_list(self):
47         self.assertIs(None, expand_command_list("test bla"))
48
49     def test_list(self):
50         self.assertEquals("test --list", expand_command_list("test $LISTOPT"))