diff --git a/tests/conftest.py b/tests/conftest.py index 5bd0b03..6328261 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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 diff --git a/tests/test_server.py b/tests/test_server.py new file mode 100644 index 0000000..2f4f3f5 --- /dev/null +++ b/tests/test_server.py @@ -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