fix: enforce durable migration ownership and readiness
This commit is contained in:
parent
14befd0b50
commit
826874a47e
5 changed files with 52 additions and 0 deletions
12
tests/test_migration_environment.py
Normal file
12
tests/test_migration_environment.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from hub_core.migrations.roles import migration_role_statement
|
||||
|
||||
|
||||
def test_migration_role_is_quoted_and_validated() -> None:
|
||||
assert migration_role_statement("hub_runtime_owner") == 'SET ROLE "hub_runtime_owner"'
|
||||
assert migration_role_statement(None) is None
|
||||
with pytest.raises(ValueError, match="safe PostgreSQL role"):
|
||||
migration_role_statement('owner"; DROP SCHEMA public; --')
|
||||
Loading…
Add table
Add a link
Reference in a new issue