Incorporate server and cli into new code #13

Merged
Jaculabilis merged 16 commits from tvb/server into develop 2021-06-16 03:53:07 +00:00
2 changed files with 28 additions and 0 deletions
Showing only changes of commit dd144bf207 - Show all commits

View File

@ -8,6 +8,8 @@ import amanuensis.backend.character as charq
import amanuensis.backend.lexicon as lexiq
import amanuensis.backend.membership as memq
import amanuensis.backend.user as userq
from amanuensis.config import AmanuensisConfig
from amanuensis.server import get_app
@pytest.fixture
@ -122,3 +124,16 @@ def lexicon_with_editor(make):
)
assert membership
return (lexicon, editor)
class TestConfig(AmanuensisConfig):
TESTING = True
SECRET_KEY = "secret key"
DATABASE_URI = "sqlite:///:memory:"
@pytest.fixture
def app(db):
"""Provides an application running on top of the test database."""
server_app = get_app(TestConfig, db)
return server_app

13
tests/test_server.py Normal file
View File

@ -0,0 +1,13 @@
from flask import Flask
def test_app_testing(app: Flask):
"""Confirm that the test config loads correctly."""
assert app.testing
def test_client(app: Flask):
"""Test that the test client works."""
with app.test_client() as client:
response = client.get("/")
assert b"world" in response.data