rebuild(migration): validate local legacy cutover

This commit is contained in:
leefer
2026-07-30 17:26:15 +08:00
parent 37bd9fea85
commit 198806c1bd
23 changed files with 418 additions and 27 deletions
+19
View File
@@ -187,6 +187,25 @@ def test_birth_profile_is_encrypted_and_isolated_by_account(tmp_path) -> None:
run_scenario(application, scenario)
def test_incomplete_encrypted_profile_returns_controlled_error(tmp_path) -> None:
application = create_application(Settings.for_test(tmp_path))
async def scenario(client: httpx.AsyncClient) -> None:
response, _session = await register(client, "broken-profile", USER_PASSWORD)
user_id = response.json()["account"]["id"]
encrypted = application.state.container.accounts._cipher.encrypt('{"gender":"male"}')
with sqlite3.connect(application.state.settings.database_path) as connection:
connection.execute(
"INSERT INTO birth_profiles VALUES (?,?,datetime('now'),datetime('now'))",
(user_id, encrypted),
)
result = await client.get("/api/account/profile")
assert result.status_code == 503
assert result.json()["error"]["code"] == "profile_unavailable"
run_scenario(application, scenario)
def test_membership_and_admin_are_independent_dimensions(tmp_path) -> None:
application = create_application(Settings.for_test(tmp_path))