示例#1
0
    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()
示例#2
0
    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()
示例#3
0
 def test_register(self):
     code = 18
     target = Mock()
     Reply.register(code, target)
     self.assertEqual(Reply.registry[code], target)
示例#4
0
 def test_call_not_found(self):
     reply = Reply(44, '')
     reply()
示例#5
0
 def test_register(self):
     code = 18
     target = Mock()
     Reply.register(code, target)
     self.assertEqual(Reply.registry[code], target)