release: publish saldo 0.1.0
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from app import create_app
|
||||
from app.extensions import db
|
||||
from app.models import NotificationPreference, User
|
||||
from app.seed import seed_data, seed_demo_data
|
||||
|
||||
|
||||
class TestConfig:
|
||||
TESTING = True
|
||||
SECRET_KEY = "test-secret"
|
||||
DATA_DIR = Path(tempfile.mkdtemp())
|
||||
SQLALCHEMY_DATABASE_URI = "sqlite://"
|
||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||
VAPID_PUBLIC_KEY = ""
|
||||
VAPID_PRIVATE_KEY = ""
|
||||
VAPID_CLAIMS = {"sub": "mailto:test@example.com"}
|
||||
ALLOCATION_TARGET_RULES = {
|
||||
"sparen": {"recommended_pct": 0.18, "min_pct": 0.15, "max_pct": 0.20, "label": "Sparen"},
|
||||
"urlaub": {"recommended_pct": 0.06, "min_pct": 0.05, "max_pct": 0.08, "label": "Urlaub"},
|
||||
"freizeit": {"recommended_pct": 0.07, "min_pct": 0.05, "max_pct": 0.10, "label": "Freizeit"},
|
||||
}
|
||||
DEFAULT_PERSONAL_SPLIT_DESI_PCT = 50.0
|
||||
STRONG_INCOME_CHANGE_THRESHOLD = 150.0
|
||||
APP_NAME = "Saldo Test"
|
||||
CSRF_ENABLED = False
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def app():
|
||||
app = create_app(TestConfig)
|
||||
with app.app_context():
|
||||
db.create_all()
|
||||
seed_data()
|
||||
seed_demo_data()
|
||||
yield app
|
||||
db.session.remove()
|
||||
db.drop_all()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def empty_app():
|
||||
app = create_app(TestConfig)
|
||||
with app.app_context():
|
||||
db.create_all()
|
||||
seed_data()
|
||||
yield app
|
||||
db.session.remove()
|
||||
db.drop_all()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def empty_client(empty_app):
|
||||
return empty_app.test_client()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def client(app):
|
||||
return app.test_client()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def admin_user(app):
|
||||
return User.query.filter_by(username="admin").first()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def editor_user(app):
|
||||
return User.query.filter_by(username="mitglied1").first()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def logged_in_client(client, admin_user):
|
||||
response = client.post(
|
||||
"/auth/login",
|
||||
data={"username": admin_user.username, "password": "testpass"},
|
||||
follow_redirects=True,
|
||||
)
|
||||
assert response.status_code == 200
|
||||
return client
|
||||
Reference in New Issue
Block a user