Validate table names in test row counter

This commit is contained in:
copilot-swe-agent[bot] authored and GitHub committed 2026-07-28 20:14:45 +00:00
1 parent 9635911924
commit ad2af69695
1 file changed
+4
+4
View File
@@ -31,8 +31,12 @@ from bracket.utils.id_types import TeamId
from tests.integration_tests.mocks import get_mock_token, get_mock_user
from tests.integration_tests.models import AuthContext
ROW_COUNT_TABLES = {"courts", "matches", "players", "rounds", "stage_items", "stages", "teams"}
async def assert_row_count_and_clear(table_name: str, expected_rows: int) -> None:
if table_name not in ROW_COUNT_TABLES:
raise ValueError(f"Unsupported table for row count assertion: {table_name}")
rows = await database.fetch_val(query=f"SELECT COUNT(*) FROM {table_name}")
assert rows == expected_rows
await database.execute(query=f"DELETE FROM {table_name}")