From c1558da1f3f2ad922314868d03896dc1a92c6288 Mon Sep 17 00:00:00 2001 From: Oleg Kozlov Date: Sun, 1 Jul 2018 23:16:38 +0300 Subject: [PATCH] tests for get_kpi and get_evt with as_datetime --- tests/test_export_api.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test_export_api.py b/tests/test_export_api.py index b108b20..abe2909 100644 --- a/tests/test_export_api.py +++ b/tests/test_export_api.py @@ -35,6 +35,7 @@ def test_get_kpi(self): res = api.get_kpi('dau') assert isinstance(res, list) + assert isinstance(res[0][0], str) assert len(res) == self.period_len @vcr.use_cassette(cassette_path % 'kpi-without-date', @@ -47,6 +48,15 @@ def test_get_kpi_without_date(self): assert isinstance(res, list) assert len(res) == self.period_len + @vcr.use_cassette(cassette_path % 'kpi-datetime', + filter_query_parameters=skip_lst) + def test_get_kpi_datetime(self): + api = ExportApi() + api.set_dates(self.start, self.stop) + + res = api.get_kpi('dau', as_datetime=True) + assert isinstance(res[0][0], datetime) + @mock.patch.dict(os.environ, names_dct['evt']) @vcr.use_cassette(cassette_path % 'evt', filter_query_parameters=skip_lst) def test_get_evt(self): @@ -56,6 +66,7 @@ def test_get_evt(self): res = api.get_evt(evt_name) assert isinstance(res, list) + assert isinstance(res[0][0], str) assert len(res) == self.period_len @mock.patch.dict(os.environ, names_dct['evt']) @@ -70,6 +81,17 @@ def test_get_evt_without_date(self): assert isinstance(res, list) assert len(res) == self.period_len + @mock.patch.dict(os.environ, names_dct['evt']) + @vcr.use_cassette(cassette_path % 'evt-datetime', + filter_query_parameters=skip_lst) + def test_get_evt_datetime(self): + api = ExportApi() + api.set_dates(self.start, self.stop) + evt_name = os.environ['evt_name'] + + res = api.get_evt(evt_name, as_datetime=True) + assert isinstance(res[0][0], datetime) + @vcr.use_cassette(cassette_path % 'evt-lst', filter_query_parameters=skip_lst) def test_get_evt_lst(self):