Skip to content

Commit 7cf994d

Browse files
committed
qa: Improve tests of /rest/headers and /rest/block
1 parent 0825b86 commit 7cf994d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/functional/interface_rest.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,16 @@ def run_test(self):
201201
self.log.info("Test the /block and /headers URIs")
202202
bb_hash = self.nodes[0].getbestblockhash()
203203

204+
# Check result if block does not exists
205+
assert_equal(self.test_rest_request('/headers/1/0000000000000000000000000000000000000000000000000000000000000000'), [])
206+
self.test_rest_request('/block/0000000000000000000000000000000000000000000000000000000000000000', status=404, ret_type=RetType.OBJ)
207+
208+
# Check result if block is not in the active chain
209+
self.nodes[0].invalidateblock(bb_hash)
210+
assert_equal(self.test_rest_request('/headers/1/{}'.format(bb_hash)), [])
211+
self.test_rest_request('/block/{}'.format(bb_hash))
212+
self.nodes[0].reconsiderblock(bb_hash)
213+
204214
# Check binary format
205215
response = self.test_rest_request("/block/{}".format(bb_hash), req_type=ReqType.BIN, ret_type=RetType.OBJ)
206216
assert_greater_than(int(response.getheader('content-length')), 80)

0 commit comments

Comments
 (0)