tabletop-frog/test/test_bootstrap.py

29 lines
586 B
Python
Raw Normal View History

2024-06-30 23:21:23 -07:00
import json
from ttfrog.db.bootstrap import loader
def test_dump_load(db, bootstrap):
# dump the bootstrapped data
data = json.loads(db.dump())
# clear the database and reinitialize
db.metadata.drop_all(bind=db.engine)
2024-08-21 14:14:37 -07:00
db.metadata.create_all(db.engine)
2024-06-30 23:21:23 -07:00
# load the dump
db.load(data)
# dump again and compare to the initial data
assert data == json.loads(db.dump())
def test_loader(db, bootstrap):
loader.load(db.dump())
assert len(db.Ancestry.all()) > 0
2024-07-05 14:42:11 -07:00
def test_default(db):
loader.load()
assert len(db.Ancestry.all()) > 0