Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class DummyClient(object):
- def __init__(self):
- self.d = Deferred()
- def resultRender(self, r):
- self.d.callback(r)
- # Metod from test
- def test_client_ref(self):
- """
- Test that when Command is init'ed with a Client protocol instance ref
- it executes the ref's resultRender when Command.recv_result is executed
- """
- self.client_called = False
- def client_got_called(result):
- self.client_called = True
- client = DummyClient()
- client.d.addCallback(client_got_called)
- command = cmd.Command("test", content_type="plain",
- client=client)
- command.recv_result("test")
- def cb(test):
- self.assertIsInstance(test, dict)
- command._d.addCallback(cb)
- command.success()
Add Comment
Please, Sign In to add comment