1 # test_target.py -- The tests for selftest target code
2 # Copyright (C) 2012 Jelmer Vernooij <jelmer@samba.org>
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
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.
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,
20 """Tests for selftest.target."""
22 from selftest.target import (
32 class DummyEnvironment(Environment):
34 def __init__(self, name, prefix):
47 class DummyTarget(Target):
49 def setup_env(self, name, prefix):
50 return DummyEnvironment(name, prefix)
53 class EnvironmentManagerTests(unittest.TestCase):
56 self.mgr = EnvironmentManager(DummyTarget())
60 NoneEnvironment, type(self.mgr.setup_env("none", "prefix")))
63 env = self.mgr.setup_env("something", "prefix")
64 self.assertEquals(env.name, "something")
65 self.assertEquals(env.prefix, "prefix")
68 env = self.mgr.setup_env("something", "prefix")
69 self.assertTrue(env.check())
70 self.assertTrue(self.mgr.check_env("something"))
72 self.assertFalse(env.check())
73 self.assertFalse(self.mgr.check_env("something"))