mirror of
https://github.com/apache/superset.git
synced 2026-05-24 17:25:20 +00:00
Simplify
This commit is contained in:
@@ -1285,42 +1285,6 @@ def test_start_oauth2_dance_falls_back_to_url_for(mocker: MockerFixture) -> None
|
||||
assert error.extra["redirect_uri"] == fallback_uri
|
||||
|
||||
|
||||
def test_get_rls_method_default_subquery() -> None:
|
||||
"""
|
||||
By default, an engine that supports subqueries and aliases-in-select
|
||||
uses the safer subquery RLS strategy.
|
||||
"""
|
||||
|
||||
class _Spec(BaseEngineSpec):
|
||||
allows_subqueries = True
|
||||
allows_alias_in_select = True
|
||||
|
||||
assert _Spec.get_rls_method() == RLSMethod.AS_SUBQUERY
|
||||
|
||||
|
||||
def test_get_rls_method_default_predicate_when_no_subqueries() -> None:
|
||||
"""
|
||||
Engines without subquery / alias-in-select support fall back to the
|
||||
AST predicate strategy.
|
||||
"""
|
||||
|
||||
class _Spec(BaseEngineSpec):
|
||||
allows_subqueries = False
|
||||
allows_alias_in_select = True
|
||||
|
||||
assert _Spec.get_rls_method() == RLSMethod.AS_PREDICATE
|
||||
|
||||
|
||||
def test_get_rls_method_class_attribute_override() -> None:
|
||||
"""
|
||||
Setting ``rls_method`` on an engine spec opts the engine into a specific
|
||||
strategy regardless of the subquery/alias defaults — used by engines whose
|
||||
sqlglot dialect can parse but not faithfully regenerate SQL.
|
||||
"""
|
||||
|
||||
class _SpliceSpec(BaseEngineSpec):
|
||||
allows_subqueries = True
|
||||
allows_alias_in_select = True
|
||||
rls_method = RLSMethod.AS_PREDICATE_SPLICE
|
||||
|
||||
assert _SpliceSpec.get_rls_method() == RLSMethod.AS_PREDICATE_SPLICE
|
||||
def test_default_rls_method_is_subquery() -> None:
|
||||
"""Base engine spec defaults to subquery-based RLS."""
|
||||
assert BaseEngineSpec.rls_method == RLSMethod.AS_SUBQUERY
|
||||
|
||||
Reference in New Issue
Block a user