Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
amishas157 committed Mar 8, 2017
1 parent 67abafe commit 1f2d87b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tests/test_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,26 @@ def test_profile_valid(resource_type):
access_token='pk.test')._validate_resource_type(resource_type)

def test_period_invalid():
"""Providing only one timestamp is invalid."""
with pytest.raises(errors.InvalidPeriodError):
mapbox.Analytics(access_token='pk.test')._validate_period('2016-03-22T00:00:00.000Z', None)

with pytest.raises(errors.InvalidPeriodError):
mapbox.Analytics(access_token='pk.test')._validate_period('2016-03-22T00:00:00.000Z', '2016-03-20T00:00:00.000Z')

with pytest.raises(errors.InvalidPeriodError):
mapbox.Analytics(access_token='pk.test')._validate_period('2016-03-22T00:00:00.000Z', '2017-04-20T00:00:00.000Z')

def test_period_valid():
"""Providing two valid timestamps."""
start = '2016-03-22T00:00:00.000Z'
end = '2016-03-24T00:00:00.000Z'
period = start, end
assert period == mapbox.Analytics(access_token='pk.test')._validate_period(start, end)

start = None
end = None
period = start, end
assert period == mapbox.Analytics(access_token='pk.test')._validate_period(start, end)

def test_username_invalid():
"""Username is requird."""
with pytest.raises(errors.InvalidUsernameError):
Expand Down

0 comments on commit 1f2d87b

Please sign in to comment.