Exemplo n.º 1
0
 def test_onlyErrorExceptionDetails(self):
     response = '{"error": {"message": "some error", "code": 123}}'
     try:
         jsonrpc.decodeResponse(response)
     except jsonrpc.JSONRPCError as e:
         self.assertEquals(e.strerror, 'some error')
         self.assertEquals(e.errno, 123)
         self.assertEquals(e.version, jsonrpc.VERSION_1)
Exemplo n.º 2
0
 def test_onlyErrorExceptionDetails(self):
     response = '{"error": {"message": "some error", "code": 123}}'
     try:
         jsonrpc.decodeResponse(response)
     except jsonrpc.JSONRPCError as e:
         self.assertEquals(e.strerror, 'some error')
         self.assertEquals(e.errno, 123)
         self.assertEquals(e.version, jsonrpc.VERSION_1)
Exemplo n.º 3
0
 def test_errorAndResultNullExceptionDetails(self):
     response = '{"result": null, "error": {"message": "some error", '
     response += '"code": 123}}'
     try:
         jsonrpc.decodeResponse(response)
     except jsonrpc.JSONRPCError as e:
         self.assertEquals(e.strerror, 'some error')
         self.assertEquals(e.errno, 123)
         self.assertEquals(e.version, jsonrpc.VERSION_1)
Exemplo n.º 4
0
 def test_errorAndResultNullExceptionDetails(self):
     response = '{"result": null, "error": {"message": "some error", '
     response += '"code": 123}}'
     try:
         jsonrpc.decodeResponse(response)
     except jsonrpc.JSONRPCError as e:
         self.assertEquals(e.strerror, 'some error')
         self.assertEquals(e.errno, 123)
         self.assertEquals(e.version, jsonrpc.VERSION_1)
Exemplo n.º 5
0
 def test_emptyResult(self):
     response = '{"result": null}'
     self.assertEquals(None, jsonrpc.decodeResponse(response))
Exemplo n.º 6
0
 def test_resultAndErrorNull(self):
     response = '{"result": "abcd", "error": null}'
     ret = 'abcd'
     self.assertEquals(ret, jsonrpc.decodeResponse(response))
Exemplo n.º 7
0
 def test_onlyResult(self):
     response = '{"result": "abcd"}'
     ret = 'abcd'
     self.assertEquals(ret, jsonrpc.decodeResponse(response))
Exemplo n.º 8
0
 def test_emptyResult(self):
     response = '{"result": null}'
     self.assertEquals(None, jsonrpc.decodeResponse(response))
Exemplo n.º 9
0
 def test_resultAndErrorNull(self):
     response = '{"result": "abcd", "error": null}'
     ret = 'abcd'
     self.assertEquals(ret, jsonrpc.decodeResponse(response))
Exemplo n.º 10
0
 def test_onlyResult(self):
     response = '{"result": "abcd"}'
     ret = 'abcd'
     self.assertEquals(ret, jsonrpc.decodeResponse(response))