use grung-db
This commit is contained in:
+8
-7
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user