use grung-db

This commit is contained in:
evilchili
2025-09-24 22:03:30 -07:00
parent c70204e3a6
commit fc1f121853
6 changed files with 31 additions and 125 deletions
+8 -7
View File
@@ -1,19 +1,15 @@
import os
import pytest
import ttfrog.app
from ttfrog import schema
from ttfrog.db import Database
@pytest.fixture
def app():
ttfrog.app.initialize(Database("ttfrog-tests"))
ttfrog.app.db.drop_tables()
def app(monkeypatch):
monkeypatch.setenv("TTFROG_IN_MEMORY_DB", "1")
ttfrog.app.initialize()
yield ttfrog.app
ttfrog.app.db.close()
os.unlink("ttfrog-tests")
def test_create(app):
@@ -37,3 +33,8 @@ def test_create(app):
after_update = app.db.save(john_something)
assert after_update == john_something
assert before_update != after_update
players = schema.Group(name="players", users=[john_something])
players = app.db.save(players)
players.users[0]["name"] = "fnord"
app.db.save(players)