Format the lines this change wrote, and leave the rest of the drift alone
ruff format disagrees with about two dozen files in this repository, most of them untouched by this work. Reformatting them would bury the tenant-schema change in noise, and reformatting only some of a file is its own kind of noise - so only the lines written here are brought into line, and the pre-existing drift stays where it is for whoever owns it.
This commit is contained in:
@@ -706,8 +706,7 @@ class PostgresAccountRepository(AccountRepository):
|
||||
[*params, window],
|
||||
).fetchall()
|
||||
collected.extend(
|
||||
(row["created_at"], str(row["id"]), _project_from_row(row, organization_id=candidate))
|
||||
for row in rows
|
||||
(row["created_at"], str(row["id"]), _project_from_row(row, organization_id=candidate)) for row in rows
|
||||
)
|
||||
# The ordering a shared table would have given: newest first, identifier
|
||||
# breaking ties, so a page boundary does not depend on which tenant
|
||||
@@ -719,8 +718,7 @@ class PostgresAccountRepository(AccountRepository):
|
||||
def count_projects(self, *, organization_id: UUID | None = None) -> int:
|
||||
if organization_id is None:
|
||||
return sum(
|
||||
self.count_projects(organization_id=candidate)
|
||||
for candidate in self._organizations_with_tenant_schema()
|
||||
self.count_projects(organization_id=candidate) for candidate in self._organizations_with_tenant_schema()
|
||||
)
|
||||
with self._connection(organization_id=organization_id) as connection:
|
||||
row = connection.execute("SELECT count(*) AS total FROM projects").fetchone()
|
||||
|
||||
@@ -147,8 +147,7 @@ def test_every_named_policy_table_is_actually_there() -> None:
|
||||
)
|
||||
found = [name for (name,) in rows]
|
||||
assert found == sorted(POLICY_TABLES), (
|
||||
f"POLICY_TABLES names tables that are not in public: "
|
||||
f"{sorted(set(POLICY_TABLES) - set(found))}"
|
||||
f"POLICY_TABLES names tables that are not in public: {sorted(set(POLICY_TABLES) - set(found))}"
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -300,9 +300,7 @@ def tenancy():
|
||||
# statement that names it is refused by the server rather than going
|
||||
# unread - which is the difference between a boundary and an oversight.
|
||||
role = sql.Identifier(PROBE_ROLE)
|
||||
setup.execute(
|
||||
sql.SQL("GRANT USAGE ON SCHEMA public, app, {} TO {}").format(sql.Identifier(SCHEMA_A), role)
|
||||
)
|
||||
setup.execute(sql.SQL("GRANT USAGE ON SCHEMA public, app, {} TO {}").format(sql.Identifier(SCHEMA_A), role))
|
||||
setup.execute(
|
||||
sql.SQL("GRANT SELECT, INSERT ON ALL TABLES IN SCHEMA {} TO {}").format(sql.Identifier(SCHEMA_A), role)
|
||||
)
|
||||
@@ -393,8 +391,7 @@ def test_the_search_path_holds_one_tenant_and_public_and_nothing_else(tenancy) -
|
||||
with tenancy.owner(schema) as cursor:
|
||||
path = list(cursor.execute("SELECT current_schemas(false) AS path").fetchone()["path"])
|
||||
assert path == [schema, "public"], (
|
||||
f"unexpected search path {path}: it must be this tenant's schema and public, "
|
||||
"and no other tenant's"
|
||||
f"unexpected search path {path}: it must be this tenant's schema and public, and no other tenant's"
|
||||
)
|
||||
assert other not in path
|
||||
|
||||
|
||||
Reference in New Issue
Block a user