Adds missing size field in Builder when loading data from the database

This commit is contained in:
Sergi Delgado Segura
2020-03-31 15:00:30 +02:00
parent b56123055d
commit 502f507b21
2 changed files with 6 additions and 1 deletions

View File

@@ -26,7 +26,11 @@ class Builder:
locator_uuid_map = {}
for uuid, data in appointments_data.items():
appointments[uuid] = {"locator": data.get("locator"), "end_time": data.get("end_time")}
appointments[uuid] = {
"locator": data.get("locator"),
"end_time": data.get("end_time"),
"size": len(data.get("encrypted_blob")),
}
if data.get("locator") in locator_uuid_map:
locator_uuid_map[data.get("locator")].append(uuid)

View File

@@ -46,6 +46,7 @@ def test_build_appointments():
assert uuid in appointments_data.keys()
assert appointments_data[uuid].get("locator") == appointment.get("locator")
assert appointments_data[uuid].get("end_time") == appointment.get("end_time")
assert len(appointments_data[uuid].get("encrypted_blob")) == appointment.get("size")
assert uuid in locator_uuid_map[appointment.get("locator")]