|
|
@ -216,30 +216,30 @@ class RESTTest (BitcoinTestFramework): |
|
|
|
# check binary format |
|
|
|
response = http_get_call(url.hostname, url.port, '/rest/block/'+bb_hash+self.FORMAT_SEPARATOR+"bin", "", True) |
|
|
|
assert_equal(response.status, 200) |
|
|
|
assert_greater_than(int(response.getheader('content-length')), 237) |
|
|
|
assert_greater_than(int(response.getheader('content-length')), 269) |
|
|
|
response_str = response.read() |
|
|
|
|
|
|
|
# compare with block header |
|
|
|
response_header = http_get_call(url.hostname, url.port, '/rest/headers/1/'+bb_hash+self.FORMAT_SEPARATOR+"bin", "", True) |
|
|
|
assert_equal(response_header.status, 200) |
|
|
|
assert_equal(int(response_header.getheader('content-length')), 237) |
|
|
|
assert_equal(int(response_header.getheader('content-length')), 269) |
|
|
|
response_header_str = response_header.read() |
|
|
|
assert_equal(response_str[0:237], response_header_str) |
|
|
|
assert_equal(response_str[0:269], response_header_str) |
|
|
|
|
|
|
|
# check block hex format |
|
|
|
response_hex = http_get_call(url.hostname, url.port, '/rest/block/'+bb_hash+self.FORMAT_SEPARATOR+"hex", "", True) |
|
|
|
assert_equal(response_hex.status, 200) |
|
|
|
assert_greater_than(int(response_hex.getheader('content-length')), 474) |
|
|
|
assert_greater_than(int(response_hex.getheader('content-length')), 506) |
|
|
|
response_hex_str = response_hex.read() |
|
|
|
assert_equal(response_str.encode("hex")[0:474], response_hex_str[0:474]) |
|
|
|
assert_equal(response_str.encode("hex")[0:506], response_hex_str[0:506]) |
|
|
|
|
|
|
|
# compare with hex block header |
|
|
|
response_header_hex = http_get_call(url.hostname, url.port, '/rest/headers/1/'+bb_hash+self.FORMAT_SEPARATOR+"hex", "", True) |
|
|
|
assert_equal(response_header_hex.status, 200) |
|
|
|
assert_greater_than(int(response_header_hex.getheader('content-length')), 474) |
|
|
|
assert_greater_than(int(response_header_hex.getheader('content-length')), 506) |
|
|
|
response_header_hex_str = response_header_hex.read() |
|
|
|
assert_equal(response_hex_str[0:474], response_header_hex_str[0:474]) |
|
|
|
assert_equal(response_header_str.encode("hex")[0:474], response_header_hex_str[0:474]) |
|
|
|
assert_equal(response_hex_str[0:506], response_header_hex_str[0:506]) |
|
|
|
assert_equal(response_header_str.encode("hex")[0:506], response_header_hex_str[0:506]) |
|
|
|
|
|
|
|
# check json format |
|
|
|
json_string = http_get_call(url.hostname, url.port, '/rest/block/'+bb_hash+self.FORMAT_SEPARATOR+'json') |
|
|
|