Added transmitter get cinfo option for action

pull/124/head
Steven Hiscocks 2013-02-20 23:33:39 +00:00
parent b6a68f5138
commit b36835f6f0
3 changed files with 9 additions and 3 deletions

View File

@ -90,6 +90,7 @@ protocol = [
["get <JAIL> actioncheck <ACT>", "gets the check command for the action <ACT> for <JAIL>"], ["get <JAIL> actioncheck <ACT>", "gets the check command for the action <ACT> for <JAIL>"],
["get <JAIL> actionban <ACT>", "gets the ban command for the action <ACT> for <JAIL>"], ["get <JAIL> actionban <ACT>", "gets the ban command for the action <ACT> for <JAIL>"],
["get <JAIL> actionunban <ACT>", "gets the unban command for the action <ACT> for <JAIL>"], ["get <JAIL> actionunban <ACT>", "gets the unban command for the action <ACT> for <JAIL>"],
["get <JAIL> cinfo <ACT> <KEY>", "gets the value for <KEY> for the action <ACT> for <JAIL>"],
] ]
## ##

View File

@ -266,6 +266,10 @@ class Transmitter:
elif command[1] == "actionunban": elif command[1] == "actionunban":
act = command[2] act = command[2]
return self.__server.getActionUnban(name, act) 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)") raise Exception("Invalid command (no get action or not yet implemented)")
def status(self, command): def status(self, command):

View File

@ -422,13 +422,14 @@ class Transmitter(unittest.TestCase):
self.__transm.proceed( self.__transm.proceed(
["set", self.jailName, "setcinfo", action, "KEY", "VALUE"]), ["set", self.jailName, "setcinfo", action, "KEY", "VALUE"]),
(0, "VALUE")) (0, "VALUE"))
#TODO: Implement below in server.transmitter?
"""
self.assertEqual( self.assertEqual(
self.__transm.proceed( self.__transm.proceed(
["get", self.jailName, "cinfo", action, "KEY"]), ["get", self.jailName, "cinfo", action, "KEY"]),
(0, "VALUE")) (0, "VALUE"))
""" self.assertEqual(
self.__transm.proceed(
["get", self.jailName, "cinfo", action, "InvalidKey"])[0],
1)
self.assertEqual( self.assertEqual(
self.__transm.proceed( self.__transm.proceed(
["set", self.jailName, "delcinfo", action, "KEY"]), ["set", self.jailName, "delcinfo", action, "KEY"]),