Field names in big query can contain only alphanumeric and underscore (#5641)

* Field names in big query can contain only alphanumeric and underscore

* bad quote

* better place for mutating labels

* lint

* bug fix thanks to mistercrunch

* lint

* lint again
This commit is contained in:
Sumedh Sakdeo
2018-08-21 13:45:42 -07:00
committed by Maxime Beauchemin
parent 71e0c07904
commit 80e777823b
4 changed files with 38 additions and 3 deletions

View File

@@ -122,6 +122,20 @@ class BaseVizTestCase(unittest.TestCase):
class TableVizTestCase(unittest.TestCase):
class DBEngineSpecMock:
@staticmethod
def mutate_expression_label(label):
return label
class DatabaseMock:
def __init__(self):
self.db_engine_spec = TableVizTestCase.DBEngineSpecMock()
class DatasourceMock:
def __init__(self):
self.database = TableVizTestCase.DatabaseMock()
def test_get_data_applies_percentage(self):
form_data = {
'percent_metrics': [{
@@ -137,7 +151,7 @@ class TableVizTestCase(unittest.TestCase):
'column': {'column_name': 'value1', 'type': 'DOUBLE'},
}, 'count', 'avg__C'],
}
datasource = Mock()
datasource = TableVizTestCase.DatasourceMock()
raw = {}
raw['SUM(value1)'] = [15, 20, 25, 40]
raw['avg__B'] = [10, 20, 5, 15]