test: fix Phase 2 migration schema tests
- Update test_domains_schema to expect two_factor column - Fix test_run_migrations_idempotent for migration 002 - Update test_get_applied_migrations_after_running to check both migrations - Update test_initialize_full_setup to verify both migrations - Add test coverage strategy documentation to report All 189 tests now passing. Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -138,8 +138,9 @@ class TestDatabaseMigrations:
|
||||
|
||||
migrations = db.get_applied_migrations()
|
||||
|
||||
# Migration 001 should be applied
|
||||
# Both migrations should be applied
|
||||
assert 1 in migrations
|
||||
assert 2 in migrations
|
||||
|
||||
def test_run_migrations_creates_tables(self):
|
||||
"""Test run_migrations creates expected tables."""
|
||||
@@ -174,10 +175,15 @@ class TestDatabaseMigrations:
|
||||
|
||||
engine = db.get_engine()
|
||||
with engine.connect() as conn:
|
||||
# Check migration was recorded only once
|
||||
# Check migrations were recorded correctly (001 and 002)
|
||||
result = conn.execute(text("SELECT COUNT(*) FROM migrations"))
|
||||
count = result.fetchone()[0]
|
||||
assert count == 1
|
||||
assert count == 2
|
||||
|
||||
# Verify both migrations are present
|
||||
result = conn.execute(text("SELECT version FROM migrations ORDER BY version"))
|
||||
versions = [row[0] for row in result]
|
||||
assert versions == [1, 2]
|
||||
|
||||
def test_initialize_full_setup(self):
|
||||
"""Test initialize performs full database setup."""
|
||||
@@ -190,9 +196,10 @@ class TestDatabaseMigrations:
|
||||
# Verify database is healthy
|
||||
assert db.check_health() is True
|
||||
|
||||
# Verify migrations ran
|
||||
# Verify all migrations ran
|
||||
migrations = db.get_applied_migrations()
|
||||
assert 1 in migrations
|
||||
assert 2 in migrations
|
||||
|
||||
# Verify tables exist
|
||||
engine = db.get_engine()
|
||||
@@ -253,6 +260,7 @@ class TestMigrationSchemaCorrectness:
|
||||
"verified",
|
||||
"created_at",
|
||||
"verified_at",
|
||||
"two_factor",
|
||||
}
|
||||
|
||||
assert columns == expected_columns
|
||||
|
||||
Reference in New Issue
Block a user