Skip to content

Commit 80f9828

Browse files
committed
feat: Add database configuration for integration tests
Add DATABASES and required Django apps to test_settings.py to support integration tests that use real ORM operations (wallet lifecycle tests). This change is necessary because: - Wallet tests verify model lifecycle (PENDING → ACTIVE → ERASED) - Tests verify ForeignKey relationships between Payment and Wallet - Tests verify database-level behavior (refresh_from_db, transactions) - Mock-based tests would not catch integration issues Following the pattern from testapp/settings.py, we use: - In-memory SQLite for speed - django.contrib.contenttypes (required for ForeignKey) - django.contrib.auth (common Django dependency) This is consistent with the pre-existing test structure where testapp provides real models for integration testing.
1 parent 2dacfb0 commit 80f9828

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

test_settings.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,18 @@
1313
SECRET_KEY = "NOTREALLY"
1414
PAYMENT_HOST = "example.com"
1515

16-
INSTALLED_APPS = ["payments", "django.contrib.sites"]
16+
INSTALLED_APPS = [
17+
"payments",
18+
"django.contrib.sites",
19+
"django.contrib.contenttypes",
20+
"django.contrib.auth",
21+
]
22+
23+
# Database configuration for tests that use ORM operations
24+
# (e.g., wallet tests that verify model lifecycle and relationships)
25+
DATABASES = {
26+
"default": {
27+
"ENGINE": "django.db.backends.sqlite3",
28+
"NAME": ":memory:",
29+
}
30+
}

0 commit comments

Comments
 (0)