Beispiel #1
0
 def test_invoke_handler(self):
     """
     L{MethodHandler.gotResult} invokes methods named remote_* to handle the requests.
     """
     mh = MethodHandler()
     calls = []
     mh.remote_foo = lambda **kw: calls.append(kw)
     mh.gotRequest("foo", a=1, b=[1, 2])
     self.assertEqual(calls, [{"a": 1, "b": [1, 2]}])
Beispiel #2
0
 def test_handler_response(self):
     """
     The result of the remote_* method is returned directly from L{MethodHandler.gotResult}.
     """
     mh = MethodHandler()
     calls = []
     mh.remote_foo = lambda **kw: "HOOPLA"
     result = mh.gotRequest("foo")
     self.assertEqual(result, "HOOPLA")