Skip to content

Commit ed4f5fd

Browse files
committed
Use backend from runtime context instead of fixture directly
1 parent 5d8495a commit ed4f5fd

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

tests/integration/hive_metastore/test_grant_detail.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,23 +94,21 @@ def contains_select_on_any_file(grants: Iterable[Grant]) -> bool:
9494

9595

9696
@retried(on=[NotFound, TimeoutError], timeout=dt.timedelta(minutes=3))
97-
def test_grant_findings(
98-
runtime_ctx: MockRuntimeContext, sql_backend: StatementExecutionBackend, _deployed_schema: None
99-
) -> None:
97+
def test_grant_findings(runtime_ctx: MockRuntimeContext, _deployed_schema: None) -> None:
10098
"""Test that findings are reported for a grant."""
10199

102100
# Fixture: two objects, one with a grant that is okay and the other with a grant that is not okay.
103101
group = runtime_ctx.make_group()
104102
schema = runtime_ctx.make_schema()
105103
table_a = runtime_ctx.make_table(schema_name=schema.name)
106104
table_b = runtime_ctx.make_table(schema_name=schema.name)
107-
sql_backend.execute(f"GRANT SELECT ON TABLE {table_a.full_name} TO `{group.display_name}`")
108-
sql_backend.execute(f"DENY SELECT ON TABLE {table_b.full_name} TO `{group.display_name}`")
105+
runtime_ctx.sql_backend.execute(f"GRANT SELECT ON TABLE {table_a.full_name} TO `{group.display_name}`")
106+
runtime_ctx.sql_backend.execute(f"DENY SELECT ON TABLE {table_b.full_name} TO `{group.display_name}`")
109107

110108
# Ensure the view is populated (it's based on the crawled grants) and fetch the content.
111109
GrantsCrawler(runtime_ctx.tables_crawler, runtime_ctx.udfs_crawler).snapshot()
112110

113-
rows = sql_backend.fetch(
111+
rows = runtime_ctx.sql_backend.fetch(
114112
f"""
115113
SELECT object_type, object_id, success, failures
116114
FROM {runtime_ctx.inventory_database}.grant_detail

0 commit comments

Comments
 (0)