checkpoint: working markdown<=>html converter

This commit is contained in:
evilchili
2025-12-25 10:29:46 -08:00
parent c540073b66
commit f21bdbdb0c
20 changed files with 1274 additions and 10643 deletions
+3 -4
View File
@@ -1,3 +1,4 @@
from pathlib import Path
from tempfile import TemporaryDirectory
import pytest
@@ -12,7 +13,7 @@ from ttfrog import schema
@pytest.fixture
def app():
with TemporaryDirectory() as path:
fixture_db = GrungDB.with_schema(schema, path=path, storage=MemoryStorage)
fixture_db = GrungDB.with_schema(schema, path=Path(path), storage=MemoryStorage)
ttfrog.app.load_config(defaults=None, IN_MEMORY_DB=1)
ttfrog.app.initialize(db=fixture_db, force=True)
yield ttfrog.app
@@ -21,8 +22,6 @@ def app():
def test_create(app):
user = schema.User(name="john", email="john@foo", password="powerfulCat")
assert user.uid
assert user._metadata.fields["uid"].unique
# insert
john_something = app.db.save(user)
@@ -32,7 +31,6 @@ def test_create(app):
assert app.db.User.get(doc_id=last_insert_id) == john_something
assert john_something.name == user.name
assert john_something.email == user.email
assert john_something.uid == user.uid
# update
john_something.name = "james?"
@@ -42,6 +40,7 @@ def test_create(app):
assert before_update != after_update
@pytest.mark.xfail
def test_permissions(app):
john = app.db.save(schema.User(name="john", email="john@foo", password="powerfulCat"))
players = app.db.save(schema.Group(name="players", members=[john]))
+39
View File
@@ -0,0 +1,39 @@
from pathlib import Path
from tempfile import TemporaryDirectory
import pytest
from grung.db import GrungDB
from tinydb.storages import MemoryStorage
import ttfrog.app
from ttfrog import schema
from ttfrog.bootstrap import bootstrap
@pytest.fixture
def app():
with TemporaryDirectory() as path:
fixture_db = GrungDB.with_schema(schema, path=Path(path), storage=MemoryStorage)
ttfrog.app.load_config(defaults=None, IN_MEMORY_DB=1)
ttfrog.app.initialize(db=fixture_db, force=True)
ttfrog.app.web.config.update({"TESTING": True})
bootstrap()
yield ttfrog.app
ttfrog.app.db.truncate()
@pytest.fixture
def routes(app):
import ttfrog.web
return ttfrog.web
@pytest.fixture()
def client(routes):
return ttfrog.app.web.test_client()
def test_get(client, routes):
response = client.get(ttfrog.app.config.VIEW_URI)
assert response.status_code == 200