fix: decode data bytes

This commit is contained in:
Roman 2025-01-20 14:02:18 +08:00
parent b028574a8c
commit 578efed150
No known key found for this signature in database
GPG Key ID: B8FE070B54E11B75
2 changed files with 9 additions and 9 deletions

View File

@ -1,3 +1,5 @@
import json
import allure
from src.steps.common import StepsCommon
@ -26,16 +28,14 @@ class StepsDataAvailability(StepsCommon):
@allure.step
def get_data_range(self, app_id, start, end):
response = []
response_bytes = []
query = prepare_get_range_request(app_id, start, end)
try:
response = self.node2.send_get_data_range_request(query)
response_bytes = self.node2.send_get_data_range_request(query)
except Exception as ex:
assert "Bad Request" in str(ex) or "Internal Server Error" in str(ex)
# Extract data for each index in received order
extracted_data = []
for item in response:
extracted_data.append(item[1])
return extracted_data
# Extract data ss string for each index in the received order
response = response_bytes.decode("utf-8")
parsed_data = json.loads(response)
return [item[1] for item in parsed_data]

View File

@ -15,4 +15,4 @@ class TestDataIntegrity(StepsDataAvailability):
def test_da_sampling_determines_data_presence(self):
self.disperse_data(DATA_TO_DISPERSE[0], [0] * 31 + [1], [0] * 8)
received_data = self.get_data_range([0] * 31 + [1], [0] * 8, [0] * 7 + [5])
assert DATA_TO_DISPERSE[0] == received_data[0].decode("utf-8")
assert DATA_TO_DISPERSE[0] == received_data[0]