示例#1
0
 def setUpClass(cls):
     cli.load_examples(load_test_data=True)
     utils.init(caravel)
     cls.table_ids = {
         tbl.table_name: tbl.id
         for tbl in (db.session.query(models.SqlaTable).all())
     }
示例#2
0
    def __init__(self, *args, **kwargs):
        super(CaravelTestCase, self).__init__(*args, **kwargs)
        self.client = app.test_client()

        utils.init(caravel)

        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='******')

        alpha = appbuilder.sm.find_user('alpha')
        if not alpha:
            appbuilder.sm.add_user('alpha',
                                   'alpha',
                                   'user',
                                   '*****@*****.**',
                                   appbuilder.sm.find_role('Alpha'),
                                   password='******')

        utils.init(caravel)
示例#3
0
    def __init__(self, *args, **kwargs):
        super(CaravelTestCase, self).__init__(*args, **kwargs)
        self.client = app.test_client()

        utils.init(caravel)

        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="******"
            )

        alpha = appbuilder.sm.find_user("alpha")
        if not alpha:
            appbuilder.sm.add_user(
                "alpha", "alpha", "user", "*****@*****.**", appbuilder.sm.find_role("Alpha"), password="******"
            )

        utils.init(caravel)
示例#4
0
    def __init__(self, *args, **kwargs):
        super(CaravelTestCase, self).__init__(*args, **kwargs)
        self.client = app.test_client()

        utils.init(caravel)

        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='******')

        alpha = appbuilder.sm.find_user('alpha')
        if not alpha:
            appbuilder.sm.add_user(
                'alpha', 'alpha', 'user', '*****@*****.**',
                appbuilder.sm.find_role('Alpha'),
                password='******')

        utils.init(caravel)
示例#5
0
 def setUpClass(cls):
     cli.load_examples(load_test_data=True)
     utils.init(caravel)
     cls.table_ids = {tbl.table_name: tbl.id for tbl in (
         db.session
         .query(models.SqlaTable)
         .all()
     )}
示例#6
0
 def __init__(self, *args, **kwargs):
     super(CoreTests, self).__init__(*args, **kwargs)
     self.table_ids = {
         tbl.table_name: tbl.id
         for tbl in (db.session.query(models.SqlaTable).all())
     }
     utils.init(caravel)
     self.load_examples()
示例#7
0
 def __init__(self, *args, **kwargs):
     super(CoreTests, self).__init__(*args, **kwargs)
     self.table_ids = {tbl.table_name: tbl.id  for tbl in (
         db.session
         .query(models.SqlaTable)
         .all()
     )}
     utils.init(caravel)
     self.load_examples()
示例#8
0
 def __init__(self, *args, **kwargs):
     super(CaravelTests, self).__init__(*args, **kwargs)
     self.client = app.test_client()
     role_admin = appbuilder.sm.find_role('Admin')
     user = appbuilder.sm.find_user('admin')
     if not user:
         appbuilder.sm.add_user('admin', 'admin', ' user', '*****@*****.**',
                                role_admin, 'general')
     utils.init(caravel)
     self.load_examples()
示例#9
0
 def __init__(self, *args, **kwargs):
     super(CaravelTests, self).__init__(*args, **kwargs)
     self.client = app.test_client()
     role_admin = appbuilder.sm.find_role('Admin')
     user = appbuilder.sm.find_user('admin')
     if not user:
         appbuilder.sm.add_user(
             'admin', 'admin',' user', '*****@*****.**',
             role_admin, 'general')
     utils.init(caravel)
     self.load_examples()
示例#10
0
    def __init__(self, *args, **kwargs):
        super(CaravelTestCase, self).__init__(*args, **kwargs)
        self.client = app.test_client()
        self.maxDiff = None
        utils.init(caravel)

        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='******')

        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()

        utils.init(caravel)
示例#11
0
    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))

        utils.init(caravel)

        worker_command = BASE_DIR + '/bin/caravel 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)
示例#12
0
    def __init__(self, *args, **kwargs):
        if (
                self.requires_examples and
                not os.environ.get('SOLO_TEST') and
                not os.environ.get('examples_loaded')
            ):
            cli.load_examples(load_test_data=True)
            utils.init(caravel)
            os.environ['examples_loaded'] = '1'
        super(CaravelTestCase, self).__init__(*args, **kwargs)
        self.client = app.test_client()
        self.maxDiff = None
        utils.init(caravel)

        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='******')

        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()

        utils.init(caravel)
示例#13
0
    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))

        utils.init(caravel)

        worker_command = BASE_DIR + '/bin/caravel 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)
示例#14
0
 def test_init(self):
     utils.init(caravel)