From b36835f6f061efded70c747539a1da2d66b9d270 Mon Sep 17 00:00:00 2001 From: Steven Hiscocks Date: Wed, 20 Feb 2013 23:33:39 +0000 Subject: [PATCH] Added transmitter get cinfo option for action --- common/protocol.py | 1 + server/transmitter.py | 4 ++++ testcases/servertestcase.py | 7 ++++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/common/protocol.py b/common/protocol.py index 2f8ffa6c..99a2fe09 100644 --- a/common/protocol.py +++ b/common/protocol.py @@ -90,6 +90,7 @@ protocol = [ ["get actioncheck ", "gets the check command for the action for "], ["get actionban ", "gets the ban command for the action for "], ["get actionunban ", "gets the unban command for the action for "], +["get cinfo ", "gets the value for for the action for "], ] ## diff --git a/server/transmitter.py b/server/transmitter.py index 3bd7fb14..a02b94a2 100644 --- a/server/transmitter.py +++ b/server/transmitter.py @@ -266,6 +266,10 @@ class Transmitter: elif command[1] == "actionunban": act = command[2] return self.__server.getActionUnban(name, act) + elif command[1] == "cinfo": + act = command[2] + key = command[3] + return self.__server.getCInfo(name, act, key) raise Exception("Invalid command (no get action or not yet implemented)") def status(self, command): diff --git a/testcases/servertestcase.py b/testcases/servertestcase.py index 0b33a96f..00f56b81 100644 --- a/testcases/servertestcase.py +++ b/testcases/servertestcase.py @@ -422,13 +422,14 @@ class Transmitter(unittest.TestCase): self.__transm.proceed( ["set", self.jailName, "setcinfo", action, "KEY", "VALUE"]), (0, "VALUE")) - #TODO: Implement below in server.transmitter? - """ self.assertEqual( self.__transm.proceed( ["get", self.jailName, "cinfo", action, "KEY"]), (0, "VALUE")) - """ + self.assertEqual( + self.__transm.proceed( + ["get", self.jailName, "cinfo", action, "InvalidKey"])[0], + 1) self.assertEqual( self.__transm.proceed( ["set", self.jailName, "delcinfo", action, "KEY"]),