major file restrucutre
This commit is contained in:
1 parent
ac278065d2
commit
6da4c3e379
53 files changed
+188
-180
No files matched your search
+15
-13
@@ -2,15 +2,17 @@ from pathlib import Path
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
import app as app_module
|
||||
from charts import player_session_series
|
||||
from services import (
|
||||
from boker import create_app
|
||||
from boker.charts import player_session_series
|
||||
from boker.services import (
|
||||
build_leaderboard,
|
||||
build_session_summaries,
|
||||
pending_payout_carry_items,
|
||||
)
|
||||
from storage import load_events, write_events
|
||||
from utils import session_sort_key
|
||||
from boker.storage import load_events, write_events
|
||||
from boker.utils import session_sort_key
|
||||
|
||||
_app = create_app()
|
||||
|
||||
|
||||
def cents(amount: float) -> int:
|
||||
@@ -203,8 +205,8 @@ class AccountingTests(unittest.TestCase):
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
data_path = Path(tmpdir) / "entries.csv"
|
||||
write_events(data_path, rows)
|
||||
original_path = app_module.app.config["DATA_PATH"]
|
||||
app_module.app.config["DATA_PATH"] = data_path
|
||||
original_path = _app.config["DATA_PATH"]
|
||||
_app.config["DATA_PATH"] = data_path
|
||||
|
||||
try:
|
||||
sessions = build_session_summaries(load_events(data_path))
|
||||
@@ -213,7 +215,7 @@ class AccountingTests(unittest.TestCase):
|
||||
[{"player_name": "A", "amount_cents": cents(5)}],
|
||||
)
|
||||
|
||||
with app_module.app.test_client() as client:
|
||||
with _app.test_client() as client:
|
||||
with client.session_transaction() as flask_session:
|
||||
flask_session["is_admin"] = True
|
||||
|
||||
@@ -222,7 +224,7 @@ class AccountingTests(unittest.TestCase):
|
||||
data={"session_id": "s2", "player_name": "A"},
|
||||
)
|
||||
finally:
|
||||
app_module.app.config["DATA_PATH"] = original_path
|
||||
_app.config["DATA_PATH"] = original_path
|
||||
|
||||
self.assertEqual(response.status_code, 302)
|
||||
updated_sessions = build_session_summaries(load_events(data_path))
|
||||
@@ -261,17 +263,17 @@ class AccountingTests(unittest.TestCase):
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
data_path = Path(tmpdir) / "entries.csv"
|
||||
write_events(data_path, rows)
|
||||
original_path = app_module.app.config["DATA_PATH"]
|
||||
app_module.app.config["DATA_PATH"] = data_path
|
||||
original_path = _app.config["DATA_PATH"]
|
||||
_app.config["DATA_PATH"] = data_path
|
||||
|
||||
try:
|
||||
with app_module.app.test_client() as client:
|
||||
with _app.test_client() as client:
|
||||
with client.session_transaction() as flask_session:
|
||||
flask_session["is_admin"] = True
|
||||
|
||||
response = client.post("/admin/prune-empty-sessions")
|
||||
finally:
|
||||
app_module.app.config["DATA_PATH"] = original_path
|
||||
_app.config["DATA_PATH"] = original_path
|
||||
|
||||
self.assertEqual(response.status_code, 302)
|
||||
remaining = load_events(data_path)
|
||||
|
||||
Reference in new issue
Block a user