rebuild(stage-3): establish accounts permissions and secure settings
This commit is contained in:
@@ -4,7 +4,7 @@ import sqlite3
|
||||
|
||||
import pytest
|
||||
|
||||
from backend.database import Database, Migration, MigrationError, MigrationRunner
|
||||
from backend.database import MIGRATIONS, Database, Migration, MigrationError, MigrationRunner
|
||||
from backend.database.repositories import DatabaseStatusRepository
|
||||
|
||||
|
||||
@@ -104,3 +104,24 @@ def test_non_contiguous_database_history_is_rejected(tmp_path) -> None:
|
||||
|
||||
with pytest.raises(MigrationError, match="not contiguous"):
|
||||
runner.upgrade((first, second))
|
||||
|
||||
|
||||
def test_real_account_schema_can_upgrade_and_rollback(tmp_path) -> None:
|
||||
database = Database(tmp_path / "app.db")
|
||||
runner = MigrationRunner(database)
|
||||
|
||||
assert runner.upgrade(MIGRATIONS) == (1, 2)
|
||||
assert {
|
||||
"users",
|
||||
"memberships",
|
||||
"sessions",
|
||||
"birth_profiles",
|
||||
"llm_usage_daily",
|
||||
"system_credentials",
|
||||
"llm_models",
|
||||
"llm_configuration",
|
||||
} <= table_names(database)
|
||||
|
||||
assert runner.downgrade(MIGRATIONS, target_version=0) == (2, 1)
|
||||
assert "users" not in table_names(database)
|
||||
assert "llm_models" not in table_names(database)
|
||||
|
||||
Reference in New Issue
Block a user