diff --git a/tests/test_integration_progress.py b/tests/test_integration_progress.py index 7aed9b4..c69786c 100644 --- a/tests/test_integration_progress.py +++ b/tests/test_integration_progress.py @@ -5,7 +5,7 @@ import unittest import os os.environ['FLASK_TESTING'] = 'true' # Set before importing app -from app import app, db +from app import create_app, db from models import Progress, LessonProgress from services.progress_service import ProgressService @@ -15,10 +15,11 @@ class TestProgressServiceIntegration(unittest.TestCase): def setUp(self): """Setup: Test-App und In-Memory-Datenbank""" - app.config['TESTING'] = True - app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:' - app.config['WTF_CSRF_ENABLED'] = False - self.app = app + self.app = create_app({ + 'TESTING': True, + 'SQLALCHEMY_DATABASE_URI': 'sqlite:///:memory:', + 'WTF_CSRF_ENABLED': False, + }) self.app_context = self.app.app_context() self.app_context.push() db.create_all() @@ -259,10 +260,12 @@ class TestResolveCurrentLessonIndex(unittest.TestCase): """Tests für die zentrale Lektions-Auflösung (Resume + Validierung).""" def setUp(self): - app.config['TESTING'] = True - app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:' - app.config['WTF_CSRF_ENABLED'] = False - self.app_context = app.app_context() + self.app = create_app({ + 'TESTING': True, + 'SQLALCHEMY_DATABASE_URI': 'sqlite:///:memory:', + 'WTF_CSRF_ENABLED': False, + }) + self.app_context = self.app.app_context() self.app_context.push() db.create_all() diff --git a/tests/test_integration_statistics.py b/tests/test_integration_statistics.py index 591ab2b..8c5c94b 100644 --- a/tests/test_integration_statistics.py +++ b/tests/test_integration_statistics.py @@ -6,7 +6,7 @@ import os os.environ['FLASK_TESTING'] = 'true' # Set before importing app from datetime import timedelta, date -from app import app, db +from app import create_app, db from models import LessonStatistic, DailyPractice from services.statistics_service import StatisticsService @@ -16,10 +16,11 @@ class TestStatisticsServiceIntegration(unittest.TestCase): def setUp(self): """Setup: Test-App und In-Memory-Datenbank""" - app.config['TESTING'] = True - app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:' - app.config['WTF_CSRF_ENABLED'] = False - self.app = app + self.app = create_app({ + 'TESTING': True, + 'SQLALCHEMY_DATABASE_URI': 'sqlite:///:memory:', + 'WTF_CSRF_ENABLED': False, + }) self.app_context = self.app.app_context() self.app_context.push() db.create_all()