def test__handleresponse_ValueError(self): '''Test that the _handleresponse method throws a ValueError when it reads an object that is neither a request nor a response. ''' jsonrpc = JsonRpc(None, None) jsonrpc._tasks[0] = conveyor.task.Task() with self.assertRaises(ValueError) as cm: jsonrpc._handleresponse({}, 0) self.assertEqual(({},), cm.exception.args)
def test__handleresponse_ValueError(self): '''Test that the _handleresponse method throws a ValueError when it reads an object that is neither a request nor a response. ''' jsonrpc = JsonRpc(None, None) jsonrpc._tasks[0] = conveyor.task.Task() with self.assertRaises(ValueError) as cm: jsonrpc._handleresponse({}, 0) self.assertEqual(({}, ), cm.exception.args)
def test__handleresponse_unknown(self): '''Test that the _handleresponse method logs a debugging message when it reads a response for an unknown request. ''' conveyor.test.listlogging(logging.DEBUG) jsonrpc = JsonRpc(None, None) conveyor.test.ListHandler.list = [] jsonrpc._handleresponse(None, 0) self.assertEqual(2, len(conveyor.test.ListHandler.list)) self.assertEqual('ignoring response for unknown id: 0', conveyor.test.ListHandler.list[1].getMessage())
def test__handleresponse_unknown(self): '''Test that the _handleresponse method logs a debugging message when it reads a response for an unknown request. ''' conveyor.test.listlogging(logging.DEBUG) jsonrpc = JsonRpc(None, None) conveyor.test.ListHandler.list = [] jsonrpc._handleresponse(None, 0) self.assertEqual(2, len(conveyor.test.ListHandler.list)) self.assertEqual( 'ignoring response for unknown id: 0', conveyor.test.ListHandler.list[1].getMessage())