summaryrefslogtreecommitdiff
path: root/jimbrella/test
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@fkfd.me>2022-02-05 16:39:41 +0800
committerFrederick Yin <fkfd@fkfd.me>2022-02-05 16:39:41 +0800
commitfcc3ce60bcfa57734a51723717fe681ee4bf1327 (patch)
treec8d883a6cd2b898fed85a7f717be34de242ded25 /jimbrella/test
parent14feb6a4378668d054d28a1335eacd2026b621dc (diff)
Config format switched to .ini
Eliminated toml from dependency list
Diffstat (limited to 'jimbrella/test')
-rw-r--r--jimbrella/test/jform_data.py4
-rw-r--r--jimbrella/test/test_routine.py12
2 files changed, 2 insertions, 14 deletions
diff --git a/jimbrella/test/jform_data.py b/jimbrella/test/jform_data.py
index 5d235ce..756a9ae 100644
--- a/jimbrella/test/jform_data.py
+++ b/jimbrella/test/jform_data.py
@@ -1,7 +1,6 @@
import json
from datetime import datetime, timedelta
from ..umbrellas import Umbrellas
-from ..config import *
TENANT_NAMES = ["Alice", "Bob", "Carol", "Dave", "Eve", "Frank"]
TENANT_IDS = ["01", "02", "03", "04", "05", "06"]
@@ -91,9 +90,6 @@ def mock_jform_data() -> tuple:
"code": 0,
}
- db = Umbrellas(DATABASE_PATH)
- umbrellas = db.read()
- key_numbers = [umb["id"] for umb in umbrellas]
now = datetime.now()
takeaway_rows = [
mock_answer_sheet(*ALICE, 1, 1, now - timedelta(days=7)),
diff --git a/jimbrella/test/test_routine.py b/jimbrella/test/test_routine.py
index 8d718be..b49ad28 100644
--- a/jimbrella/test/test_routine.py
+++ b/jimbrella/test/test_routine.py
@@ -9,15 +9,7 @@ from ..routine import sync_jform, process_overdue
from ..umbrellas import Umbrellas
from ..jform import JForm
from ..admin_log import AdminLog
-from ..config import *
-
-"""Set up logging.
-logging.basicConfig(
- filename="/tmp/jimbrella.log",
- encoding="utf-8",
- level=logging.INFO,
- format="[%(asctime)s] %(levelname)s:%(name)s:%(message)s",
-)"""
+from ..config import config
"""Spin up a simple Flask app to mimic jForm."""
jform = Flask(__name__)
@@ -65,7 +57,7 @@ if __name__ == "__main__":
mock_jform.start()
"""Initialize Database and JForm."""
- shutil.copyfile(DATABASE_PATH, TEST_DATABASE_PATH)
+ shutil.copyfile(config.get("general", "db_path"), TEST_DATABASE_PATH)
db = Umbrellas(TEST_DATABASE_PATH)
takeaway_jform = JForm("takeaway", "http://localhost:5001/takeaway", "/tmp")
giveback_jform = JForm("giveback", "http://localhost:5001/giveback", "/tmp")