mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
[utils.py] gathering/refactoring into a "utils/" folder (#6095)
* [utils] gathering/refactoring into a "utils/" folder Moving current utils.py into utils/core.py and moving other *util* modules under this new "utils/" as well. Following steps include eroding at "utils/core.py" and breaking it down into smaller modules. * Improve tests * Make loading examples in scope for tests * Remove test class attrs examples_loaded and requires_examples
This commit is contained in:
committed by
Beto Dealmeida
parent
af0ffa44ab
commit
bbfd69a138
@@ -1,44 +1,29 @@
|
||||
"""Unit tests for Superset"""
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import unittest
|
||||
|
||||
from flask_appbuilder.security.sqla import models as ab_models
|
||||
from mock import Mock
|
||||
import pandas as pd
|
||||
|
||||
from superset import app, cli, db, security_manager
|
||||
from superset import app, db, security_manager
|
||||
from superset.connectors.druid.models import DruidCluster, DruidDatasource
|
||||
from superset.connectors.sqla.models import SqlaTable
|
||||
from superset.models import core as models
|
||||
from superset.utils import get_main_database
|
||||
|
||||
from superset.utils.core import get_main_database
|
||||
|
||||
BASE_DIR = app.config.get('BASE_DIR')
|
||||
|
||||
|
||||
class SupersetTestCase(unittest.TestCase):
|
||||
requires_examples = False
|
||||
examples_loaded = False
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if (
|
||||
self.requires_examples and
|
||||
not os.environ.get('examples_loaded')
|
||||
):
|
||||
logging.info('Loading examples')
|
||||
cli.load_examples_run(load_test_data=True)
|
||||
logging.info('Done loading examples')
|
||||
security_manager.sync_role_definitions()
|
||||
os.environ['examples_loaded'] = '1'
|
||||
else:
|
||||
security_manager.sync_role_definitions()
|
||||
super(SupersetTestCase, self).__init__(*args, **kwargs)
|
||||
self.client = app.test_client()
|
||||
self.maxDiff = None
|
||||
|
||||
cli.load_test_users_run()
|
||||
@classmethod
|
||||
def create_druid_test_objects(cls):
|
||||
# create druid cluster and druid datasources
|
||||
session = db.session
|
||||
cluster = (
|
||||
|
||||
Reference in New Issue
Block a user