summaryrefslogtreecommitdiff
path: root/jimbrella/test/jform_data.py
diff options
context:
space:
mode:
Diffstat (limited to 'jimbrella/test/jform_data.py')
-rw-r--r--jimbrella/test/jform_data.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/jimbrella/test/jform_data.py b/jimbrella/test/jform_data.py
index 358da8a..5d235ce 100644
--- a/jimbrella/test/jform_data.py
+++ b/jimbrella/test/jform_data.py
@@ -1,14 +1,12 @@
import json
from datetime import datetime, timedelta
-from ..database import Database
+from ..umbrellas import Umbrellas
from ..config import *
TENANT_NAMES = ["Alice", "Bob", "Carol", "Dave", "Eve", "Frank"]
TENANT_IDS = ["01", "02", "03", "04", "05", "06"]
TENANT_PHONES = ["0001", "0002", "0003", "0004", "0005", "0006"]
-TENANTS = [
- (TENANT_NAMES[i], TENANT_IDS[i], TENANT_PHONES[i]) for i in range(len(TENANT_NAMES))
-]
+TENANTS = zip(TENANT_NAMES, TENANT_IDS, TENANT_PHONES)
ALICE, BOB, CAROL, DAVE, EVE, FRANK = tuple(TENANTS)
@@ -32,13 +30,15 @@ def mock_answer_sheet(
"question": {"id": 9957462, "title": "3. 联系方式Phone"},
},
{
- "answer": key_no,
+ "answer": str(key_no),
"question": {"id": 9957463, "title": "4. 钥匙编号Key's Number"},
},
],
"id": sheet_id,
"ip_address": "127.0.0.1",
"status": 0,
+ # NOTE: jForm omits trailing zeros in milliseconds,
+ # but datetime.datetime.isoformat does not
"submitted_at": time.isoformat(timespec="milliseconds") + "+08:00",
"tags": [],
"user": {"name": tenant_name, "organization": "密西根学院"},
@@ -91,9 +91,9 @@ def mock_jform_data() -> tuple:
"code": 0,
}
- db = Database(DATABASE_PATH)
+ db = Umbrellas(DATABASE_PATH)
umbrellas = db.read()
- key_numbers = [umb["serial"] for umb in umbrellas]
+ key_numbers = [umb["id"] for umb in umbrellas]
now = datetime.now()
takeaway_rows = [
mock_answer_sheet(*ALICE, 1, 1, now - timedelta(days=7)),