Skip to content

Commit

Permalink
qa: Improve tests of /rest/headers and /rest/block
Browse files Browse the repository at this point in the history
  • Loading branch information
promag committed Jan 16, 2019
1 parent 0825b86 commit 7cf994d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/functional/interface_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,16 @@ def run_test(self):
self.log.info("Test the /block and /headers URIs")
bb_hash = self.nodes[0].getbestblockhash()

# Check result if block does not exists
assert_equal(self.test_rest_request('/headers/1/0000000000000000000000000000000000000000000000000000000000000000'), [])
self.test_rest_request('/block/0000000000000000000000000000000000000000000000000000000000000000', status=404, ret_type=RetType.OBJ)

# Check result if block is not in the active chain
self.nodes[0].invalidateblock(bb_hash)
assert_equal(self.test_rest_request('/headers/1/{}'.format(bb_hash)), [])
self.test_rest_request('/block/{}'.format(bb_hash))
self.nodes[0].reconsiderblock(bb_hash)

# Check binary format
response = self.test_rest_request("/block/{}".format(bb_hash), req_type=ReqType.BIN, ret_type=RetType.OBJ)
assert_greater_than(int(response.getheader('content-length')), 80)
Expand Down

0 comments on commit 7cf994d

Please sign in to comment.