MCPcopy Create free account
hub / github.com/dbcli/mssql-cli / test_nested_request

Method test_nested_request

tests/jsonrpc/test_jsonrpc.py:51–81  ·  view source on GitHub ↗

Verify submission of a valid nested request.

(self)

Source from the content-addressed store, hash-verified

49 self.assertTrue(test_stream.closed)
50
51 def test_nested_request(self):
52 """
53 Verify submission of a valid nested request.
54 """
55 test_stream = io.BytesIO()
56 json_rpc_writer = jsonrpc.JsonRpcWriter(test_stream)
57 json_rpc_writer.send_request(
58 method=u'testMethod/DoThis',
59 params={
60 u'Key': u'Value',
61 u'key2': {
62 u'key3': u'value3',
63 u'key4': u'value4'}},
64 request_id=1)
65
66 test_stream.seek(0)
67 json_rpc_reader = jsonrpc.JsonRpcReader(test_stream)
68 response = json_rpc_reader.read_response()
69 baseline = {
70 u'jsonrpc': u'2.0',
71 u'params': {
72 u'Key': u'Value',
73 u'key2': {
74 u'key3': u'value3',
75 u'key4': u'value4'}},
76 u'method': u'testMethod/DoThis',
77 u'id': 1}
78 self.assertEqual(response, baseline)
79
80 json_rpc_reader.close()
81 self.assertTrue(test_stream.closed)
82
83 def test_response_multiple_headers(self):
84 """

Callers

nothing calls this directly

Calls 3

send_requestMethod · 0.95
read_responseMethod · 0.95
closeMethod · 0.95

Tested by

no test coverage detected