diff options
| author | João Barbosa <[email protected]> | 2019-01-16 14:46:09 +0000 |
|---|---|---|
| committer | João Barbosa <[email protected]> | 2019-01-16 14:46:09 +0000 |
| commit | 7cf994d5cfd53dcff76ebd0e0007e3477a7570e8 (patch) | |
| tree | 2b9bb26ee50364a8abe3fdcfade46f6dd3660bf7 /test/functional/interface_rest.py | |
| parent | doc: /rest/block responds with 404 if block does not exist (diff) | |
| download | discoin-7cf994d5cfd53dcff76ebd0e0007e3477a7570e8.tar.xz discoin-7cf994d5cfd53dcff76ebd0e0007e3477a7570e8.zip | |
qa: Improve tests of /rest/headers and /rest/block
Diffstat (limited to 'test/functional/interface_rest.py')
| -rwxr-xr-x | test/functional/interface_rest.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/functional/interface_rest.py b/test/functional/interface_rest.py index afa9de580..23b13fc4f 100755 --- a/test/functional/interface_rest.py +++ b/test/functional/interface_rest.py @@ -201,6 +201,16 @@ class RESTTest (BitcoinTestFramework): 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) |