Add json import/export

This commit is contained in:
evilchili
2024-06-30 23:21:23 -07:00
parent 68251ff4e9
commit 551140b5bc
9 changed files with 334 additions and 49 deletions
+23
View File
@@ -0,0 +1,23 @@
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)
db.init()
# 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