From 616116a84120220adb8e36cb364f08b0a638807e Mon Sep 17 00:00:00 2001 From: Frederick Yin Date: Thu, 3 Feb 2022 16:11:20 +0800 Subject: Adapt test suites --- jimbrella/test/jform_data.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'jimbrella/test/jform_data.py') 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)), -- cgit v1.2.3