def test_match_int9(self): mock_meth = unittest.mock.MagicMock() self.dispatcher.map("/debug", mock_meth) osc_server._UDPHandler( [_SIMPLE_PARAM_INT_9, None], self.client_address, self.server) self.assertTrue(mock_meth.called) mock_meth.assert_called_with("/debug", 9)
def test_match_int9(self): mock_meth = unittest.mock.MagicMock() self.dispatcher.map("/debug", mock_meth) osc_server._UDPHandler([_SIMPLE_PARAM_INT_9, None], self.client_address, self.server) self.assertTrue(mock_meth.called) mock_meth.assert_called_with("/debug", 9)
def test_match_default_handler(self): mock_meth = unittest.mock.MagicMock() self.dispatcher.set_default_handler(mock_meth) osc_server._UDPHandler([_SIMPLE_MSG_NO_PARAMS, None], self.client_address, self.server) mock_meth.assert_called_with("/SYNC")
def test_match_with_args(self): mock_meth = unittest.mock.MagicMock() self.dispatcher.map("/SYNC", mock_meth, 1, 2, 3) osc_server._UDPHandler([_SIMPLE_PARAM_INT_MSG, None], self.client_address, self.server) mock_meth.assert_called_with("/SYNC", [1, 2, 3], 4)
def test_no_match(self): mock_meth = unittest.mock.MagicMock() self.dispatcher.map("/foobar", mock_meth) osc_server._UDPHandler([_SIMPLE_PARAM_INT_MSG, None], self.client_address, self.server) self.assertFalse(mock_meth.called)
def test_match_default_handler(self): mock_meth = unittest.mock.MagicMock() self.dispatcher.set_default_handler(mock_meth) osc_server._UDPHandler( [_SIMPLE_MSG_NO_PARAMS, None], self.client_address, self.server) mock_meth.assert_called_with("/SYNC")
def test_match_with_args(self): mock_meth = unittest.mock.MagicMock() self.dispatcher.map("/SYNC", mock_meth, 1, 2, 3) osc_server._UDPHandler( [_SIMPLE_PARAM_INT_MSG, None], self.client_address, self.server) mock_meth.assert_called_with("/SYNC", [1, 2, 3], 4)
def test_no_match(self): mock_meth = unittest.mock.MagicMock() self.dispatcher.map("/foobar", mock_meth) osc_server._UDPHandler( [_SIMPLE_PARAM_INT_MSG, None], self.client_address, self.server) self.assertFalse(mock_meth.called)