Exemplo n.º 1
0
 def test_valid_error(self):
     response = {
         "jsonrpc": "2.0",
         "error": {
             "code": -32600,
             "message": "some message",
             "data": None
         },
         "id": None,
     }
     assert json_rpc.valid_response(response)
Exemplo n.º 2
0
 def test_no_id(self):
     response = {"jsonrpc": "2.0", "result": "a result"}
     assert not json_rpc.valid_response(response)
Exemplo n.º 3
0
 def test_no_result_or_error(self):
     response = {"jsonrpc": "2.0", "id": 29471507}
     assert not json_rpc.valid_response(response)
Exemplo n.º 4
0
 def test_no_jsonrpc(self):
     response = {"result": "a result", "id": 29471507}
     assert not json_rpc.valid_response(response)
Exemplo n.º 5
0
 def test_int_id(self):
     response = {"jsonrpc": "2.0", "result": None, "id": 29471507}
     assert json_rpc.valid_response(response)
Exemplo n.º 6
0
 def test_string_id(self):
     response = {"jsonrpc": "2.0", "result": None, "id": "sdflkjdjfk"}
     assert json_rpc.valid_response(response)
Exemplo n.º 7
0
 def test_valid_result(self):
     # Use a value of "None" for the result to try and trip it up. Same for
     # id.
     response = {"jsonrpc": "2.0", "result": None, "id": None}
     assert json_rpc.valid_response(response)