def test_executer_factor_class_method(self): """ test if either a sequential or multprocessing executer gets returned """ sequential = app.Runner()._get_executer() multi_proc = app.Runner(parallelism=2)._get_executer() self.assertEqual(sequential.__class__.__name__, "SequentialExecuter") self.assertEqual(multi_proc.__class__.__name__, "MultiProcessingExecuter")
def test_start_sql_parsing(self): """ test if start method works """ ap = app.Runner() ap.start_sql_parsing() self.assertIsNotNone(ap.dependencies)
def test_search_files(self): """ test if files get searched and return """ expected_files = [ 'old-join.sql', 'third.sql', 'select_statement.sql', 'cte.sql', 'with.sql', 'old-view.sql' ] ap = app.Runner() ap.search_files() foundfiles = [os.path.basename(f) for f in ap.allfiles] self.assertEqual(sorted(foundfiles), sorted(expected_files))
def test_start(self): """ test if main start method works """ ap = app.Runner(bulk_load=True) ap.start() query = self.query_result() res = [] for el in query: res.append(el.filename) self.assertIn('old-join.sql', res)
def test_single_insert(self): """ test if single insert works """ dep = [{ 'filename': 'old-join.sql', 'name': None, 'tables': ['CUSTOMERS', 'ORDERS', 'PRODUCT'] }] ap = app.Runner() ap.dependencies = dep ap._insertdep() query = self.query_result()[0] self.assertEqual('old-join.sql', query.filename)
def test_data_load(self): """ test if data load factory maethod works """ dep = [{ 'filename': 'old-join.sql', 'name': None, 'tables': ['CUSTOMERS', 'ORDERS', 'PRODUCT'] }] ap = app.Runner() ap.dependencies = dep ap._data_load() query = self.query_result()[0] self.assertEqual('old-join.sql', query.filename)
def test_if_runner_class_exists(self): """ test if Runner class is available """ klass = app.Runner() self.assertEqual(klass.__class__.__name__, "Runner")