32 lines
736 B
Python
32 lines
736 B
Python
from pathlib import Path
|
|
|
|
import app.db as db
|
|
|
|
|
|
def test_app_starts(client):
|
|
response = client.get("/boxes")
|
|
|
|
assert response.status_code == 200
|
|
|
|
|
|
def test_root_redirects_to_boxes(client):
|
|
response = client.get("/", follow_redirects=False)
|
|
|
|
assert response.status_code == 302
|
|
assert response.headers["location"] == "/boxes"
|
|
|
|
|
|
def test_boxes_page_returns_200(client):
|
|
response = client.get("/boxes")
|
|
|
|
assert response.status_code == 200
|
|
assert "Boxes page" in response.text
|
|
|
|
|
|
def test_tests_use_isolated_sqlite_database(client):
|
|
assert db.engine is not None
|
|
|
|
database_name = Path(db.engine.url.database)
|
|
assert database_name.name == "test.db"
|
|
assert "data/app.db" not in str(database_name)
|