rest: add a test for unsuported /blockpart/ request type

This commit is contained in:
Roman Zeyde
2025-12-15 23:34:11 +01:00
parent 55d0d19b5c
commit 7fe94a0493

View File

@@ -489,7 +489,11 @@ class RESTTest (BitcoinTestFramework):
get_block_part(status=400, query_params={"offset": len(block_bin) + 1, "size": 1})
get_block_part(status=400, query_params={"offset": 0, "size": len(block_bin) + 1})
self.test_rest_request(f"/blockpart/{blockhash}", status=400, req_type=ReqType.JSON, ret_type=RetType.OBJ)
res = self.test_rest_request(f"/blockpart/{blockhash}", status=400, req_type=ReqType.BIN, ret_type=RetType.OBJ)
assert res.read().decode().startswith("Block part offset missing or invalid")
res = self.test_rest_request(f"/blockpart/{blockhash}", query_params={"offset":0, "size":1}, status=400, req_type=ReqType.JSON, ret_type=RetType.OBJ)
assert res.read().decode().startswith("JSON output is not supported for this request type")
self.log.info("Missing block data should cause REST API to fail")