def test_call(self): code = 18 payload = 1234 target = Mock() Reply.register(code, target) # test reply = Reply(code, payload) reply() # validation target.assert_called_once_with(payload) target.return_value.assert_called_once_with()
def test_register(self): code = 18 target = Mock() Reply.register(code, target) self.assertEqual(Reply.registry[code], target)
def test_call_not_found(self): reply = Reply(44, '') reply()