Test fix: malformed owner_ids validated before the seed's early return
The seed validates candidates only when the allowlist is empty; the test's successful first seed masked the malformed case. The rejection now runs first. Suite: 908 passed.
This commit is contained in:
@@ -354,14 +354,9 @@ async def test_setup_owner_fallback_not_used_when_context_present(
|
|||||||
|
|
||||||
def test_seed_owner_ids_argument(tmp_path) -> None:
|
def test_seed_owner_ids_argument(tmp_path) -> None:
|
||||||
async def _body(database):
|
async def _body(database):
|
||||||
seeded = await seed_setup_admin(
|
# Malformed owner lists are rejected like any other candidate —
|
||||||
database,
|
# while the allowlist is still empty, so the seed proceeds far
|
||||||
stored_admin_ids=None,
|
# enough to validate.
|
||||||
context_user_id=None,
|
|
||||||
owner_ids=["owner-1"],
|
|
||||||
)
|
|
||||||
assert seeded == ["owner-1"]
|
|
||||||
# Malformed owner lists are rejected like any other candidate.
|
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
await seed_setup_admin(
|
await seed_setup_admin(
|
||||||
database,
|
database,
|
||||||
@@ -369,6 +364,14 @@ def test_seed_owner_ids_argument(tmp_path) -> None:
|
|||||||
context_user_id=None,
|
context_user_id=None,
|
||||||
owner_ids=[7],
|
owner_ids=[7],
|
||||||
)
|
)
|
||||||
|
assert await list_admin_ids(database) == []
|
||||||
|
seeded = await seed_setup_admin(
|
||||||
|
database,
|
||||||
|
stored_admin_ids=None,
|
||||||
|
context_user_id=None,
|
||||||
|
owner_ids=["owner-1"],
|
||||||
|
)
|
||||||
|
assert seeded == ["owner-1"]
|
||||||
return seeded
|
return seeded
|
||||||
|
|
||||||
_with_db(tmp_path, "seed-owner-arg.db")(_body)
|
_with_db(tmp_path, "seed-owner-arg.db")(_body)
|
||||||
|
|||||||
Reference in New Issue
Block a user