def setUpClass(cls): try: os.remove(app.config.get('SQL_CELERY_DB_FILE_PATH')) except OSError as e: app.logger.warn(str(e)) try: os.remove(app.config.get('SQL_CELERY_RESULTS_DB_FILE_PATH')) except OSError as e: app.logger.warn(str(e)) sync_role_definitions() worker_command = BASE_DIR + '/bin/superset worker' subprocess.Popen( worker_command, shell=True, stdout=subprocess.PIPE) admin = appbuilder.sm.find_user('admin') if not admin: appbuilder.sm.add_user( 'admin', 'admin', ' user', '*****@*****.**', appbuilder.sm.find_role('Admin'), password='******') cli.load_examples(load_test_data=True)
def setUpClass(cls): try: os.remove(app.config.get('SQL_CELERY_DB_FILE_PATH')) except OSError as e: app.logger.warn(str(e)) try: os.remove(app.config.get('SQL_CELERY_RESULTS_DB_FILE_PATH')) except OSError as e: app.logger.warn(str(e)) sync_role_definitions() worker_command = BASE_DIR + '/bin/superset worker' subprocess.Popen(worker_command, shell=True, stdout=subprocess.PIPE) admin = appbuilder.sm.find_user('admin') if not admin: appbuilder.sm.add_user('admin', 'admin', ' user', '*****@*****.**', appbuilder.sm.find_role('Admin'), password='******') cli.load_examples(load_test_data=True)
def __init__(self, *args, **kwargs): if (self.requires_examples and not os.environ.get('SOLO_TEST') and not os.environ.get('examples_loaded')): logging.info("Loading examples") cli.load_examples(load_test_data=True) logging.info("Done loading examples") sync_role_definitions() os.environ['examples_loaded'] = '1' else: sync_role_definitions() super(SupersetTestCase, self).__init__(*args, **kwargs) self.client = app.test_client() self.maxDiff = None gamma_sqllab = sm.add_role("gamma_sqllab") for perm in sm.find_role('Gamma').permissions: sm.add_permission_role(gamma_sqllab, perm) for perm in sm.find_role('sql_lab').permissions: sm.add_permission_role(gamma_sqllab, perm) admin = appbuilder.sm.find_user('admin') if not admin: appbuilder.sm.add_user('admin', 'admin', ' user', '*****@*****.**', appbuilder.sm.find_role('Admin'), password='******') gamma = appbuilder.sm.find_user('gamma') if not gamma: appbuilder.sm.add_user('gamma', 'gamma', 'user', '*****@*****.**', appbuilder.sm.find_role('Gamma'), password='******') gamma_sqllab = appbuilder.sm.find_user('gamma_sqllab') if not gamma_sqllab: gamma_sqllab = appbuilder.sm.add_user( 'gamma_sqllab', 'gamma_sqllab', 'user', '*****@*****.**', appbuilder.sm.find_role('gamma_sqllab'), password='******') alpha = appbuilder.sm.find_user('alpha') if not alpha: appbuilder.sm.add_user('alpha', 'alpha', 'user', '*****@*****.**', appbuilder.sm.find_role('Alpha'), password='******') # create druid cluster and druid datasources session = db.session cluster = session.query( models.DruidCluster).filter_by(cluster_name="druid_test").first() if not cluster: cluster = models.DruidCluster(cluster_name="druid_test") session.add(cluster) session.commit() druid_datasource1 = models.DruidDatasource( datasource_name='druid_ds_1', cluster_name='druid_test') session.add(druid_datasource1) druid_datasource2 = models.DruidDatasource( datasource_name='druid_ds_2', cluster_name='druid_test') session.add(druid_datasource2) session.commit()
def init(): """Inits the Superset application""" security.sync_role_definitions()
def __init__(self, *args, **kwargs): if ( self.requires_examples and not os.environ.get('SOLO_TEST') and not os.environ.get('examples_loaded') ): logging.info("Loading examples") cli.load_examples(load_test_data=True) logging.info("Done loading examples") sync_role_definitions() os.environ['examples_loaded'] = '1' else: sync_role_definitions() super(SupersetTestCase, self).__init__(*args, **kwargs) self.client = app.test_client() self.maxDiff = None gamma_sqllab_role = sm.add_role("gamma_sqllab") for perm in sm.find_role('Gamma').permissions: sm.add_permission_role(gamma_sqllab_role, perm) db_perm = self.get_main_database(sm.get_session).perm security.merge_perm(sm, 'database_access', db_perm) db_pvm = sm.find_permission_view_menu( view_menu_name=db_perm, permission_name='database_access') gamma_sqllab_role.permissions.append(db_pvm) for perm in sm.find_role('sql_lab').permissions: sm.add_permission_role(gamma_sqllab_role, perm) admin = appbuilder.sm.find_user('admin') if not admin: appbuilder.sm.add_user( 'admin', 'admin', ' user', '*****@*****.**', appbuilder.sm.find_role('Admin'), password='******') gamma = appbuilder.sm.find_user('gamma') if not gamma: appbuilder.sm.add_user( 'gamma', 'gamma', 'user', '*****@*****.**', appbuilder.sm.find_role('Gamma'), password='******') gamma2 = appbuilder.sm.find_user('gamma2') if not gamma2: appbuilder.sm.add_user( 'gamma2', 'gamma2', 'user', '*****@*****.**', appbuilder.sm.find_role('Gamma'), password='******') gamma_sqllab_user = appbuilder.sm.find_user('gamma_sqllab') if not gamma_sqllab_user: appbuilder.sm.add_user( 'gamma_sqllab', 'gamma_sqllab', 'user', '*****@*****.**', gamma_sqllab_role, password='******') alpha = appbuilder.sm.find_user('alpha') if not alpha: appbuilder.sm.add_user( 'alpha', 'alpha', 'user', '*****@*****.**', appbuilder.sm.find_role('Alpha'), password='******') sm.get_session.commit() # create druid cluster and druid datasources session = db.session cluster = ( session.query(DruidCluster) .filter_by(cluster_name="druid_test") .first() ) if not cluster: cluster = DruidCluster(cluster_name="druid_test") session.add(cluster) session.commit() druid_datasource1 = DruidDatasource( datasource_name='druid_ds_1', cluster_name='druid_test' ) session.add(druid_datasource1) druid_datasource2 = DruidDatasource( datasource_name='druid_ds_2', cluster_name='druid_test' ) session.add(druid_datasource2) session.commit()
def __init__(self, *args, **kwargs): if (self.requires_examples and not os.environ.get('SOLO_TEST') and not os.environ.get('examples_loaded')): logging.info('Loading examples') cli.load_examples(load_test_data=True) logging.info('Done loading examples') sync_role_definitions() os.environ['examples_loaded'] = '1' else: sync_role_definitions() super(SupersetTestCase, self).__init__(*args, **kwargs) self.client = app.test_client() self.maxDiff = None gamma_sqllab_role = sm.add_role('gamma_sqllab') for perm in sm.find_role('Gamma').permissions: sm.add_permission_role(gamma_sqllab_role, perm) db_perm = self.get_main_database(sm.get_session).perm security.merge_perm(sm, 'database_access', db_perm) db_pvm = sm.find_permission_view_menu( view_menu_name=db_perm, permission_name='database_access') gamma_sqllab_role.permissions.append(db_pvm) for perm in sm.find_role('sql_lab').permissions: sm.add_permission_role(gamma_sqllab_role, perm) admin = appbuilder.sm.find_user('admin') if not admin: appbuilder.sm.add_user('admin', 'admin', ' user', '*****@*****.**', appbuilder.sm.find_role('Admin'), password='******') gamma = appbuilder.sm.find_user('gamma') if not gamma: appbuilder.sm.add_user('gamma', 'gamma', 'user', '*****@*****.**', appbuilder.sm.find_role('Gamma'), password='******') gamma2 = appbuilder.sm.find_user('gamma2') if not gamma2: appbuilder.sm.add_user('gamma2', 'gamma2', 'user', '*****@*****.**', appbuilder.sm.find_role('Gamma'), password='******') gamma_sqllab_user = appbuilder.sm.find_user('gamma_sqllab') if not gamma_sqllab_user: appbuilder.sm.add_user('gamma_sqllab', 'gamma_sqllab', 'user', '*****@*****.**', gamma_sqllab_role, password='******') alpha = appbuilder.sm.find_user('alpha') if not alpha: appbuilder.sm.add_user('alpha', 'alpha', 'user', '*****@*****.**', appbuilder.sm.find_role('Alpha'), password='******') sm.get_session.commit() # create druid cluster and druid datasources session = db.session cluster = (session.query(DruidCluster).filter_by( cluster_name='druid_test').first()) if not cluster: cluster = DruidCluster(cluster_name='druid_test') session.add(cluster) session.commit() druid_datasource1 = DruidDatasource( datasource_name='druid_ds_1', cluster_name='druid_test', ) session.add(druid_datasource1) druid_datasource2 = DruidDatasource( datasource_name='druid_ds_2', cluster_name='druid_test', ) session.add(druid_datasource2) session.commit()
def __init__(self, *args, **kwargs): if ( self.requires_examples and not os.environ.get('SOLO_TEST') and not os.environ.get('examples_loaded') ): logging.info("Loading examples") cli.load_examples(load_test_data=True) logging.info("Done loading examples") sync_role_definitions() os.environ['examples_loaded'] = '1' else: sync_role_definitions() super(SupersetTestCase, self).__init__(*args, **kwargs) self.client = app.test_client() self.maxDiff = None gamma_sqllab = sm.add_role("gamma_sqllab") for perm in sm.find_role('Gamma').permissions: sm.add_permission_role(gamma_sqllab, perm) for perm in sm.find_role('sql_lab').permissions: sm.add_permission_role(gamma_sqllab, perm) admin = appbuilder.sm.find_user('admin') if not admin: appbuilder.sm.add_user( 'admin', 'admin', ' user', '*****@*****.**', appbuilder.sm.find_role('Admin'), password='******') gamma = appbuilder.sm.find_user('gamma') if not gamma: appbuilder.sm.add_user( 'gamma', 'gamma', 'user', '*****@*****.**', appbuilder.sm.find_role('Gamma'), password='******') gamma_sqllab = appbuilder.sm.find_user('gamma_sqllab') if not gamma_sqllab: gamma_sqllab = appbuilder.sm.add_user( 'gamma_sqllab', 'gamma_sqllab', 'user', '*****@*****.**', appbuilder.sm.find_role('gamma_sqllab'), password='******') alpha = appbuilder.sm.find_user('alpha') if not alpha: appbuilder.sm.add_user( 'alpha', 'alpha', 'user', '*****@*****.**', appbuilder.sm.find_role('Alpha'), password='******') # create druid cluster and druid datasources session = db.session cluster = session.query(models.DruidCluster).filter_by( cluster_name="druid_test").first() if not cluster: cluster = models.DruidCluster(cluster_name="druid_test") session.add(cluster) session.commit() druid_datasource1 = models.DruidDatasource( datasource_name='druid_ds_1', cluster_name='druid_test' ) session.add(druid_datasource1) druid_datasource2 = models.DruidDatasource( datasource_name='druid_ds_2', cluster_name='druid_test' ) session.add(druid_datasource2) session.commit()
def __init__(self, *args, **kwargs): if self.requires_examples and not os.environ.get("SOLO_TEST") and not os.environ.get("examples_loaded"): logging.info("Loading examples") cli.load_examples(load_test_data=True) logging.info("Done loading examples") sync_role_definitions() os.environ["examples_loaded"] = "1" else: sync_role_definitions() super(SupersetTestCase, self).__init__(*args, **kwargs) self.client = app.test_client() self.maxDiff = None gamma_sqllab_role = sm.add_role("gamma_sqllab") for perm in sm.find_role("Gamma").permissions: sm.add_permission_role(gamma_sqllab_role, perm) db_perm = self.get_main_database(sm.get_session).perm security.merge_perm(sm, "database_access", db_perm) db_pvm = sm.find_permission_view_menu(view_menu_name=db_perm, permission_name="database_access") gamma_sqllab_role.permissions.append(db_pvm) for perm in sm.find_role("sql_lab").permissions: sm.add_permission_role(gamma_sqllab_role, perm) admin = appbuilder.sm.find_user("admin") if not admin: appbuilder.sm.add_user( "admin", "admin", " user", "*****@*****.**", appbuilder.sm.find_role("Admin"), password="******" ) gamma = appbuilder.sm.find_user("gamma") if not gamma: appbuilder.sm.add_user( "gamma", "gamma", "user", "*****@*****.**", appbuilder.sm.find_role("Gamma"), password="******" ) gamma_sqllab_user = appbuilder.sm.find_user("gamma_sqllab") if not gamma_sqllab_user: appbuilder.sm.add_user( "gamma_sqllab", "gamma_sqllab", "user", "*****@*****.**", gamma_sqllab_role, password="******" ) alpha = appbuilder.sm.find_user("alpha") if not alpha: appbuilder.sm.add_user( "alpha", "alpha", "user", "*****@*****.**", appbuilder.sm.find_role("Alpha"), password="******" ) sm.get_session.commit() # create druid cluster and druid datasources session = db.session cluster = session.query(models.DruidCluster).filter_by(cluster_name="druid_test").first() if not cluster: cluster = models.DruidCluster(cluster_name="druid_test") session.add(cluster) session.commit() druid_datasource1 = models.DruidDatasource(datasource_name="druid_ds_1", cluster_name="druid_test") session.add(druid_datasource1) druid_datasource2 = models.DruidDatasource(datasource_name="druid_ds_2", cluster_name="druid_test") session.add(druid_datasource2) session.commit()