Redesign BP tracker with lightweight views and unobtrusive save confirmations

This commit is contained in:
Peter Stockings
2026-09-08 15:07:57 +10:00
parent 25d1774e53
commit 87b60aac9b
40 changed files with 2693 additions and 2553 deletions
+38
View File
@@ -0,0 +1,38 @@
import os
import sys
from pathlib import Path
import pytest
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
os.environ['FLASK_CONFIG'] = 'TestingConfig'
from app import create_app, db
from app.config import TestingConfig
from app.models import Profile, User
@pytest.fixture
def app(monkeypatch):
monkeypatch.setattr(TestingConfig, 'SQLALCHEMY_DATABASE_URI', 'sqlite:///:memory:')
monkeypatch.setattr(TestingConfig, 'WTF_CSRF_ENABLED', False, raising=False)
application = create_app()
with application.app_context():
db.create_all()
db.session.add_all([
User(id=1, username='fixture', password_hash='unused', profile=Profile(timezone='Australia/Sydney')),
User(id=2, username='other', password_hash='unused', profile=Profile(timezone='UTC')),
])
db.session.commit()
yield application
db.session.remove()
db.drop_all()
@pytest.fixture
def client(app):
client = app.test_client()
with client.session_transaction() as session:
session['_user_id'] = '1'
session['_fresh'] = True
return client