correcting the unittest and using Mock() for user and fs
@@ -787,6 +787,8 @@ def test_create_ddl_with_abfs():
def test_create_table_from_local():
+ with patch('indexer.indexers.sql.get_interpreter') as get_interpreter:
+ get_interpreter.return_value = {'Name': 'Hive', 'dialect': 'hive'}
source = {
'path': '',
'sourceType': 'hive'
@@ -812,8 +814,7 @@ def test_create_table_from_local():
'indexerPrimaryKey': [],
'sourceType': 'hive'
}
- request = MockRequest(fs=MockFs())
- sql = SQLIndexer(user=request.user, fs=request.fs).create_table_from_local_file(source, destination).get_str()
+ sql = SQLIndexer(user=Mock(), fs=Mock()).create_table_from_local_file(source, destination).get_str()
statement = '''USE default;
@@ -837,6 +838,8 @@ CREATE TABLE IF NOT EXISTS default.test1 (
def test_create_table_from_local_mysql():
+ with patch('indexer.indexers.sql.get_interpreter') as get_interpreter:
+ get_interpreter.return_value = {'Name': 'MySQL', 'dialect': 'mysql'}
source = {
'path': '/apps/beeswax/data/tables/us_population.csv',
'sourceType': 'mysql',
@@ -851,8 +854,7 @@ def test_create_table_from_local_mysql():
],
'sourceType': 'mysql'
}
- request = MockRequest(fs=MockFs())
- sql = SQLIndexer(user=request.user, fs=request.fs).create_table_from_local_file(source, destination).get_str()
+ sql = SQLIndexer(user=Mock(), fs=Mock()).create_table_from_local_file(source, destination).get_str()
statement = '''USE default;
