Skip to content

Commit

Permalink
tests for get_kpi and get_evt with as_datetime
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg Kozlov committed Jul 1, 2018
1 parent bed8a9a commit c1558da
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/test_export_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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):
Expand All @@ -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'])
Expand All @@ -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):
Expand Down

0 comments on commit c1558da

Please sign in to comment.