feat: add unit test for LimitMethod.FETCH_MANY (#13364)

This commit is contained in:
Beto Dealmeida 2021-03-01 10:55:37 -08:00 committed by GitHub
parent 36fda5e840
commit 08183dfe57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 1 deletions

View File

@ -20,7 +20,11 @@ from unittest import mock
import pytest
from superset.db_engine_specs import engines
from superset.db_engine_specs.base import BaseEngineSpec, builtin_time_grains
from superset.db_engine_specs.base import (
BaseEngineSpec,
builtin_time_grains,
LimitMethod,
)
from superset.db_engine_specs.sqlite import SqliteEngineSpec
from superset.sql_parse import ParsedQuery
from superset.utils.core import get_example_database
@ -154,6 +158,14 @@ class TestDbEngineSpecs(TestDbEngineSpec):
"""SELECT 'LIMIT 777'""", """SELECT 'LIMIT 777'\nLIMIT 1000"""
)
def test_limit_with_fetch_many(self):
class DummyEngineSpec(BaseEngineSpec):
limit_method = LimitMethod.FETCH_MANY
self.sql_limit_regex(
"SELECT * FROM table", "SELECT * FROM table", DummyEngineSpec
)
def test_time_grain_denylist(self):
with app.app_context():
app.config["TIME_GRAIN_DENYLIST"] = ["PT1M"]