test: removed unicode_test example from unit tests (#11131)

* Removed depemdency to unicode example in tests config.

* Added common methods for creating dashboards for tests.

* Added fixtures to all tests which were using unicode example.

* Added cleanup for unicode_test table

* Removed unnecessary fixture parts of unicode dashboard tests

* Parametrized creating slice for tests

* Moved fixtures for unicode test to separate file and refactored to several methods. Added param types and return types.

* Cleandup after fix

* Changed variable names to more readable

* Added cleanup for dashboards and slices

* Applied unicode fixture to charts api tests

* Update schema variable to dtype in dashboard utils

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>

* Changed variable schema to dtype in dashboards. Replaced accessing first element with one_or_none

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>
This commit is contained in:
Kasia Kucharczyk
2020-10-07 17:29:37 +02:00
committed by GitHub
parent 1fa8bf7d7b
commit 32e174d4b8
7 changed files with 239 additions and 7 deletions

View File

@@ -16,17 +16,28 @@
# under the License.
# isort:skip_file
"""Unit tests for Superset"""
import datetime
import json
import pandas as pd
import prison
import pytest
import random
from sqlalchemy import String, Date, Float
from sqlalchemy.sql import func
from superset import db, security_manager
from superset import db, security_manager, ConnectorRegistry
from superset.connectors.sqla.models import SqlaTable
from superset.models.core import Database
from superset.utils.core import get_example_database, get_main_database
from tests.base_tests import SupersetTestCase
from tests.dashboard_utils import (
create_table_for_dashboard,
create_dashboard,
)
from tests.fixtures.certificates import ssl_certificate
from tests.fixtures.unicode_dashboard import load_unicode_dashboard_with_position
from tests.test_app import app
@@ -758,6 +769,7 @@ class TestDatabaseApi(SupersetTestCase):
}
self.assertEqual(response, expected_response)
@pytest.mark.usefixtures("load_unicode_dashboard_with_position")
def test_get_database_related_objects(self):
"""
Database API: Test get chart and dashboard count related to a database