feat(tally): registry, JSON persistence, voice-status HTTP, session hook (#1338)
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -96,6 +96,21 @@ def test_format_status_after_draw():
|
||||
assert format_status(t, "en") == "0W-1L: Draw against ENEMY"
|
||||
|
||||
|
||||
def test_persistence_roundtrip(tmp_path_env=None):
|
||||
import tempfile, os, importlib
|
||||
import BOT.tally as tal
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
tal.TALLY_PATH = Path(d) / "TALLY.json"
|
||||
tal._REGISTRY.clear()
|
||||
tal.claim(10, 20, "player", "bravo", "Bravo", user_id=99)
|
||||
# reload into a clean registry from disk
|
||||
tal._REGISTRY.clear()
|
||||
tal.load_from_disk()
|
||||
got = tal.get(10, 20)
|
||||
assert got is not None
|
||||
assert got.mode == "player" and got.target == "bravo" and got.claimed_by == 99
|
||||
|
||||
|
||||
def _run():
|
||||
fns = [v for k, v in sorted(globals().items()) if k.startswith("test_")]
|
||||
for fn in fns:
|
||||
|
||||
Reference in New Issue
Block a user