def test_make_request(self): procedure = {"id": 1, "method": "messages.sendMessage", "params": {"to": "chat", "message": "Hello World!"}} request = make_request(procedure) self.assertIsInstance(request, RPCRequest) self.assertEqual(request.rpc_id, procedure["id"]) self.assertEqual(request.rpc_method, procedure["method"]) self.assertEqual(request.rpc_params, procedure["params"])
def test_make_invalid_request_raises_error(self): procedure = {"id": 1, "method": "messages.sendMessage"} with self.assertRaises(RPCInvalidRequest): make_request(procedure)