Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
hughhhh committed Apr 4, 2023
1 parent 060d644 commit 2e94740
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 21 deletions.
13 changes: 8 additions & 5 deletions superset/charts/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ def ensure_thumbnails_enabled(self) -> Optional[Response]:
"query_context",
"is_managed_externally",
]

show_columns += ["tags.id", "tags.name", "tags.type"]
if is_feature_enabled("TAGGING_SYSTEM"):
show_columns += ["tags.id", "tags.name", "tags.type"]

show_select_columns = show_columns + ["table.id"]
list_columns = [
Expand Down Expand Up @@ -195,7 +195,8 @@ def ensure_thumbnails_enabled(self) -> Optional[Response]:
"url",
"viz_type",
]
list_columns += ["tags.id", "tags.name", "tags.type"]
if is_feature_enabled("TAGGING_SYSTEM"):
list_columns += ["tags.id", "tags.name", "tags.type"]
list_select_columns = list_columns + ["changed_by_fk", "changed_on"]
order_columns = [
"changed_by.first_name",
Expand Down Expand Up @@ -224,7 +225,8 @@ def ensure_thumbnails_enabled(self) -> Optional[Response]:
"slice_name",
"viz_type",
]
search_columns += ["tags"]
if is_feature_enabled("TAGGING_SYSTEM"):
search_columns += ["tags"]
base_order = ("changed_on", "desc")
base_filters = [["id", ChartFilter, lambda: []]]
search_filters = {
Expand All @@ -236,7 +238,8 @@ def ensure_thumbnails_enabled(self) -> Optional[Response]:
"slice_name": [ChartAllTextFilter],
"created_by": [ChartHasCreatedByFilter, ChartCreatedByMeFilter],
}
search_filters["tags"] = [ChartTagFilter]
if is_feature_enabled("TAGGING_SYSTEM"):
search_filters["tags"] = [ChartTagFilter]

# Will just affect _info endpoint
edit_columns = ["slice_name"]
Expand Down
34 changes: 24 additions & 10 deletions superset/dashboards/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ def ensure_thumbnails_enabled(self) -> Optional[Response]:
"roles.name",
"is_managed_externally",
]
list_columns += ["tags.id", "tags.name", "tags.type"]
if is_feature_enabled("TAGGING_SYSTEM"):
list_columns += ["tags.id", "tags.name", "tags.type"]
list_select_columns = list_columns + ["changed_on", "created_on", "changed_by_fk"]
order_columns = [
"changed_by.first_name",
Expand All @@ -216,15 +217,28 @@ def ensure_thumbnails_enabled(self) -> Optional[Response]:
edit_columns = add_columns

search_columns = (
"created_by",
"changed_by",
"dashboard_title",
"id",
"owners",
"published",
"roles",
"slug",
"tags",
(
"created_by",
"changed_by",
"dashboard_title",
"id",
"owners",
"published",
"roles",
"slug",
"tags",
)
if is_feature_enabled("TAGGING_SYSTEM")
else (
"created_by",
"changed_by",
"dashboard_title",
"id",
"owners",
"published",
"roles",
"slug",
)
)
search_filters = {
"dashboard_title": [DashboardTitleOrSlugFilter],
Expand Down
11 changes: 7 additions & 4 deletions superset/queries/saved_queries/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from flask_appbuilder.models.sqla.interface import SQLAInterface
from flask_babel import ngettext

from superset import is_feature_enabled
from superset.commands.importers.exceptions import (
IncorrectFormatError,
NoValidFilesFoundError,
Expand Down Expand Up @@ -118,7 +119,8 @@ class SavedQueryRestApi(BaseSupersetModelRestApi):
"sql",
"sql_tables",
]
list_columns += ["tags.id", "tags.name", "tags.type"]
if is_feature_enabled("TAGGING_SYSTEM"):
list_columns += ["tags.id", "tags.name", "tags.type"]
list_select_columns = list_columns + ["changed_by_fk", "changed_on"]
add_columns = [
"db_id",
Expand All @@ -143,13 +145,14 @@ class SavedQueryRestApi(BaseSupersetModelRestApi):
]

search_columns = ["id", "database", "label", "schema", "created_by"]
search_columns += ["tags"]
if is_feature_enabled("TAGGING_SYSTEM"):
search_columns += ["tags"]
search_filters = {
"id": [SavedQueryFavoriteFilter],
"label": [SavedQueryAllTextFilter],
}

search_filters["tags"] = [SavedQueryTagFilter]
if is_feature_enabled("TAGGING_SYSTEM"):
search_filters["tags"] = [SavedQueryTagFilter]

apispec_parameter_schemas = {
"get_delete_ids_schema": get_delete_ids_schema,
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/tags/dao_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,5 +296,5 @@ def test_delete_tagged_object(self):
def test_validate_tag_name(self):
assert TagDAO.validate_tag_name("example_tag_name") is True
assert TagDAO.validate_tag_name("invalid:tag_name") is False
db.session.query(Tag).delete()
db.session.query(TaggedObject).delete()
db.session.query(Tag).delete()
1 change: 0 additions & 1 deletion tests/integration_tests/tasks/async_queries_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

class TestAsyncQueries(SupersetTestCase):
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
@pytest.mark.usefixtures("with_tagging_system_feature")
@mock.patch.object(async_query_manager, "update_job")
@mock.patch.object(async_queries, "set_form_data")
def test_load_chart_data_into_cache(self, mock_set_form_data, mock_update_job):
Expand Down

0 comments on commit 2e94740

Please sign in to comment.