diff --git a/tests/test_metabase_api.py b/tests/test_metabase_api.py index f6d98a0..226e2b9 100644 --- a/tests/test_metabase_api.py +++ b/tests/test_metabase_api.py @@ -251,11 +251,22 @@ def test_search(self): def test_get_card_data(self): # json res = mb.get_card_data(card_id=1) + json_data = [ + {'col1': 'row1 cell1', 'col2': 1}, + {'col1': None, 'col2': 2}, + {'col1': 'row3 cell1', 'col2': None}, + {'col1': None, 'col2': None}, + {'col1': 'row5 cell1', 'col2': 5} + ] + self.assertEqual(res, json_data) + + # formatted rows (in json export mode, None become '' and numbers become strings, e.g. 123 -> '123') + res = mb.get_card_data(card_id=1, format_rows=True) json_data = [ {'col1': 'row1 cell1', 'col2': '1'}, {'col1': '', 'col2': '2'}, - {'col1': 'row3 cell1', 'col2': None}, - {'col1': '', 'col2': None}, + {'col1': 'row3 cell1', 'col2': ''}, + {'col1': '', 'col2': ''}, {'col1': 'row5 cell1', 'col2': '5'} ] self.assertEqual(res, json_data)