selftest.target: Add tests for check.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 4 Mar 2012 01:29:34 +0000 (02:29 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 4 Mar 2012 17:02:06 +0000 (18:02 +0100)
selftest/target/__init__.py
selftest/tests/test_target.py

index ac2cc19..72e0770 100644 (file)
@@ -128,11 +128,10 @@ class EnvironmentManager(object):
                 raise EnvironmentDown(running_env.get_log())
             return running_env
 
-
         env = self.target.setup_env(envname, prefix)
         if env is None:
             return None
 
-        self.running_envs[env] = env
+        self.running_envs[envname] = env
 
         return env
index 343de93..0abc79b 100644 (file)
@@ -63,3 +63,11 @@ class EnvironmentManagerTests(unittest.TestCase):
         env = self.mgr.setup_env("something", "prefix")
         self.assertEquals(env.name, "something")
         self.assertEquals(env.prefix, "prefix")
+
+    def test_check(self):
+        env = self.mgr.setup_env("something", "prefix")
+        self.assertTrue(env.check())
+        self.assertTrue(self.mgr.check_env("something"))
+        env.check_ret = False
+        self.assertFalse(env.check())
+        self.assertFalse(self.mgr.check_env("something"))