X-Git-Url: https://code.grnet.gr/git/ganeti-local/blobdiff_plain/949dcb1d5f3dc571ddd4114b1593c344221c6033..48aaca91efa214b37dba94f28582be73f3c90dbd:/test/ganeti.hooks_unittest.py?ds=sidebyside diff --git a/test/ganeti.hooks_unittest.py b/test/ganeti.hooks_unittest.py index ddeb105..e20fc11 100755 --- a/test/ganeti.hooks_unittest.py +++ b/test/ganeti.hooks_unittest.py @@ -36,6 +36,7 @@ from ganeti import constants from ganeti import cmdlib from ganeti import rpc from ganeti import compat +from ganeti import pathutils from ganeti.constants import HKR_SUCCESS, HKR_FAIL, HKR_SKIP from mocks import FakeConfig, FakeProc, FakeContext @@ -205,7 +206,7 @@ def FakeHooksRpcSuccess(node_list, hpath, phase, env): """ rr = rpc.RpcResult return dict([(node, rr((True, [("utest", constants.HKR_SUCCESS, "ok")]), - node=node, call='FakeScriptOk')) + node=node, call="FakeScriptOk")) for node in node_list]) @@ -224,8 +225,8 @@ class TestHooksMaster(unittest.TestCase): @return: rpc failure from all nodes """ - return dict([(node, rpc.RpcResult('error', failed=True, - node=node, call='FakeError')) for node in node_list]) + return dict([(node, rpc.RpcResult("error", failed=True, + node=node, call="FakeError")) for node in node_list]) @staticmethod def _call_script_fail(node_list, hpath, phase, env): @@ -237,7 +238,7 @@ class TestHooksMaster(unittest.TestCase): """ rr = rpc.RpcResult return dict([(node, rr((True, [("utest", constants.HKR_FAIL, "err")]), - node=node, call='FakeScriptFail')) + node=node, call="FakeScriptFail")) for node in node_list]) def setUp(self): @@ -313,7 +314,7 @@ class TestHooksRunnerEnv(unittest.TestCase): self.assertEqual(env["GANETI_HOOKS_PATH"], hpath) self.assertEqual(env["GANETI_OP_CODE"], self.op.OP_ID) self.assertEqual(env["GANETI_HOOKS_VERSION"], str(constants.HOOKS_VERSION)) - self.assertEqual(env["GANETI_DATA_DIR"], constants.DATA_DIR) + self.assertEqual(env["GANETI_DATA_DIR"], pathutils.DATA_DIR) if "GANETI_OBJECT_TYPE" in env: self.assertEqual(env["GANETI_OBJECT_TYPE"], constants.HTYPE_GROUP) else: @@ -494,5 +495,5 @@ class TestHooksRunnerEnv(unittest.TestCase): assert isinstance(self.lu, FakeNoHooksLU), "LU was replaced" -if __name__ == '__main__': +if __name__ == "__main__": testutils.GanetiTestProgram()