Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
betodealmeida committed Nov 6, 2023
1 parent 491a2ce commit 7f6b422
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions superset/db_engine_specs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,8 @@ class BaseEngineSpec: # pylint: disable=too-many-public-methods

@classmethod
def get_allows_alias_in_select(
cls, database: Database
) -> bool: # pylint: disable=unused-argument
cls, database: Database # pylint: disable=unused-argument
) -> bool:
"""
Method for dynamic `allows_alias_in_select`.
Expand Down
16 changes: 16 additions & 0 deletions tests/unit_tests/db_engine_specs/test_dremio.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from typing import Optional

import pytest
from pytest_mock import MockerFixture

from tests.unit_tests.db_engine_specs.utils import assert_convert_dttm
from tests.unit_tests.fixtures.common import dttm
Expand All @@ -40,3 +41,18 @@ def test_convert_dttm(
from superset.db_engine_specs.dremio import DremioEngineSpec as spec

assert_convert_dttm(spec, target_type, expected_result, dttm)


def test_get_allows_alias_in_select(mocker: MockerFixture) -> None:
from superset.db_engine_specs.dremio import DremioEngineSpec

database = mocker.MagicMock()

database.get_extra.return_value = {}
assert DremioEngineSpec.get_allows_alias_in_select(database) is True

database.get_extra.return_value = {"version": "24.1.0"}
assert DremioEngineSpec.get_allows_alias_in_select(database) is True

database.get_extra.return_value = {"version": "24.0.0"}
assert DremioEngineSpec.get_allows_alias_in_select(database) is False

0 comments on commit 7f6b422

Please sign in to comment.