def test_correct_file_load_supplied_engine_success(self):
     """
     Simple loading of one valid fdp into DB with supplied engine
     """
     MODEL_NAME, SAMPLE_PACKAGE = SAMPLE_PACKAGES['md']
     self.loader.load_fdp_to_db(SAMPLE_PACKAGE, config.get_engine())
     self.cm = model_registry.ModelRegistry()
     self.assertGreater(len(list(self.cm.list_models())), 0, 'no dataset was loaded')
Esempio n. 2
0
 def test_correct_file_load_supplied_engine_success(self):
     """
     Simple loading of one valid fdp into DB with supplied engine
     """
     MODEL_NAME, SAMPLE_PACKAGE = SAMPLE_PACKAGES['md']
     loader.FDPLoader(config.get_engine()).load_fdp_to_db(SAMPLE_PACKAGE)
     cm = model_registry.ModelRegistry()
     assert len(list(cm.list_models())) > 0, 'no dataset was loaded'
 def test_create_tables_cmd_success(self):
     """
     Simple invocation of the create-tables command
     """
     self.runner.invoke(cli,
                        args=['create-tables'],
                        env={'OS_ELASTICSEARCH_ADDRESS': LOCAL_ELASTICSEARCH})
     engine = config.get_engine()
     inspector = Inspector.from_engine(engine)
     self.assertTrue('models' not in inspector.get_table_names())
 def test_create_tables_cmd_success(self, cli_runner,
                                    elasticsearch_address):
     """
     Simple invocation of the create-tables command
     """
     cli_runner.invoke(
         cli,
         args=['create-tables'],
         env={'OS_ELASTICSEARCH_ADDRESS': elasticsearch_address})
     engine = config.get_engine()
     inspector = Inspector.from_engine(engine)
     assert 'models' not in inspector.get_table_names()
 def setUp(self):
     """
     Set-up a dummy DB for the tests
     :return:
     """
     self.es = Elasticsearch(hosts=[LOCAL_ELASTICSEARCH])
     try:
         self.es.indices.delete(index="packages")
     except NotFoundError:
         pass
     config._set_connection_string("sqlite:///:memory:")
     fdp_loader = loader.FDPLoader(config.get_engine())
     fdp_loader.load_fdp_to_db(SAMPLE_PACKAGE)
Esempio n. 6
0
 def test_get_cube_correct_values(self):
     cm = model_registry.ModelRegistry()
     model = cm.get_model(MODEL_NAME)
     cube = Cube(config.get_engine(), model['fact_table'], model)
     facts = cube.facts(fields=['year'], page_size=5)
     assert facts['total_fact_count'] == NUM_RECORDS, 'wrong number of records'
def conn():
    _conn = config.get_engine().connect()
    yield _conn
    _conn.close()
 def test_get_cube_correct_values(self):
     cm = model_registry.ModelRegistry()
     model = cm.get_model(MODEL_NAME)
     cube = Cube(config.get_engine(), model["fact_table"], model)
     facts = cube.facts(page_size=5)
     self.assertEquals(facts["total_fact_count"], NUM_RECORDS, "wrong number of records")