This commit is contained in:
@@ -119,6 +119,31 @@ def test_clear_sales_cache_removes_shared_page_cache_files(tmp_path, monkeypatch
|
||||
assert not cache_file.exists()
|
||||
|
||||
|
||||
def test_daily_sales_shared_view_cache_roundtrip(tmp_path, monkeypatch):
|
||||
from routes import daily_sales_routes
|
||||
|
||||
monkeypatch.setattr(daily_sales_routes, "_DAILY_SALES_VIEW_CACHE_DIR", tmp_path)
|
||||
cache_key = "daily_sales:view:test"
|
||||
context = {"summary": {"revenue": 456}, "active_page": "daily_sales"}
|
||||
|
||||
daily_sales_routes._set_shared_daily_view_cache(cache_key, context)
|
||||
|
||||
assert daily_sales_routes._get_shared_daily_view_cache(cache_key) == context
|
||||
|
||||
|
||||
def test_clear_daily_sales_cache_removes_shared_view_cache_files(tmp_path, monkeypatch):
|
||||
from services import cache_manager
|
||||
|
||||
monkeypatch.setattr(cache_manager, "_DAILY_SALES_VIEW_CACHE_DIR", tmp_path)
|
||||
tmp_path.mkdir(parents=True, exist_ok=True)
|
||||
cache_file = tmp_path / "daily_sales_view.pkl"
|
||||
cache_file.write_bytes(b"stale")
|
||||
|
||||
cache_manager.clear_daily_sales_cache()
|
||||
|
||||
assert not cache_file.exists()
|
||||
|
||||
|
||||
def test_cache_dicts_are_only_defined_in_cache_manager():
|
||||
assignments = []
|
||||
for path in [ROOT / "app.py", *ROOT.glob("routes/*.py"), *ROOT.glob("services/*.py")]:
|
||||
|
||||
Reference in New Issue
Block a user