Changeset View
Changeset View
Standalone View
Standalone View
test/functional/interface_rpc.py
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | def test_batch_request(self): | ||||
results = self.nodes[0].batch([ | results = self.nodes[0].batch([ | ||||
# A basic request that will work fine. | # A basic request that will work fine. | ||||
{"method": "getblockcount", "id": 1}, | {"method": "getblockcount", "id": 1}, | ||||
# Request that will fail. The whole batch request should still | # Request that will fail. The whole batch request should still | ||||
# work fine. | # work fine. | ||||
{"method": "invalidmethod", "id": 2}, | {"method": "invalidmethod", "id": 2}, | ||||
# Another call that should succeed. | # Another call that should succeed. | ||||
{"method": "getbestblockhash", "id": 3}, | {"method": "getblockhash", "id": 3, "params": [0]}, | ||||
]) | ]) | ||||
result_by_id = {} | result_by_id = {} | ||||
for res in results: | for res in results: | ||||
result_by_id[res["id"]] = res | result_by_id[res["id"]] = res | ||||
assert_equal(result_by_id[1]['error'], None) | assert_equal(result_by_id[1]['error'], None) | ||||
assert_equal(result_by_id[1]['result'], 0) | assert_equal(result_by_id[1]['result'], 0) | ||||
Show All 21 Lines |