예제 #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)