Add function to retrieve family of an ip address
[ganeti-local] / test / ganeti.hooks_unittest.py
index 5826f9b..594c321 100755 (executable)
@@ -39,11 +39,15 @@ from ganeti.constants import HKR_SUCCESS, HKR_FAIL, HKR_SKIP
 
 from mocks import FakeConfig, FakeProc, FakeContext
 
+import testutils
+
+
 class FakeLU(cmdlib.LogicalUnit):
   HPATH = "test"
   def BuildHooksEnv(self):
     return {}, ["localhost"], ["localhost"]
 
+
 class TestHooksRunner(unittest.TestCase):
   """Testing case for HooksRunner"""
   def setUp(self):
@@ -240,14 +244,14 @@ class TestHooksMaster(unittest.TestCase):
 
   def testTotalFalse(self):
     """Test complete rpc failure"""
-    hm = mcpu.HooksMaster(self._call_false, FakeProc(), self.lu)
+    hm = mcpu.HooksMaster(self._call_false, self.lu)
     self.failUnlessRaises(errors.HooksFailure,
                           hm.RunPhase, constants.HOOKS_PHASE_PRE)
     hm.RunPhase(constants.HOOKS_PHASE_POST)
 
   def testIndividualFalse(self):
     """Test individual node failure"""
-    hm = mcpu.HooksMaster(self._call_nodes_false, FakeProc(), self.lu)
+    hm = mcpu.HooksMaster(self._call_nodes_false, self.lu)
     hm.RunPhase(constants.HOOKS_PHASE_PRE)
     #self.failUnlessRaises(errors.HooksFailure,
     #                      hm.RunPhase, constants.HOOKS_PHASE_PRE)
@@ -255,16 +259,17 @@ class TestHooksMaster(unittest.TestCase):
 
   def testScriptFalse(self):
     """Test individual rpc failure"""
-    hm = mcpu.HooksMaster(self._call_script_fail, FakeProc(), self.lu)
+    hm = mcpu.HooksMaster(self._call_script_fail, self.lu)
     self.failUnlessRaises(errors.HooksAbort,
                           hm.RunPhase, constants.HOOKS_PHASE_PRE)
     hm.RunPhase(constants.HOOKS_PHASE_POST)
 
   def testScriptSucceed(self):
     """Test individual rpc failure"""
-    hm = mcpu.HooksMaster(self._call_script_succeed, FakeProc(), self.lu)
+    hm = mcpu.HooksMaster(self._call_script_succeed, self.lu)
     for phase in (constants.HOOKS_PHASE_PRE, constants.HOOKS_PHASE_POST):
       hm.RunPhase(phase)
 
+
 if __name__ == '__main__':
-  unittest.main()
+  testutils.GanetiTestProgram()