Skip to content

Commit

Permalink
Updating tests to check both underscores and dicts for event params
Browse files Browse the repository at this point in the history
  • Loading branch information
robertkern committed Jul 18, 2017
1 parent a8cee49 commit 2e7afe5
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions tests/endpoints/v1/events_tests.py
Expand Up @@ -12,14 +12,32 @@
class EventsTest(unittest.TestCase):

@with_mock_client()
def test_search_params(self, client):
def test_search_params_underscores(self, client):
client.events.search(id="id", q="query", rank_level=[4,5], rank__gt=85, country=["NZ", "AU"],
within__radius="2km", within__longitude=-71.0432, within__latitude=42.346,
label=["label1", "label2"], category="category",
place={"scope": ["place1", "place2"], "exact": "place3"},
place__scope=["place1", "place2"], place__exact=["place3"],
start__gte="2016-03-01", start__lt=datetime(2016, 4, 1), start__tz="Pacific/Auckland",
active__gte="2016-03-01", active__lt=datetime(2016, 4, 1), active__tz="Pacific/Auckland",
signal__id='zVNLr8tHvWQw', signal__explain=datetime(2016, 4, 1))
signal__id="zVNLr8tHvWQw", signal__explain=datetime(2016, 4, 1))

client.request.assert_called_once_with('get', '/v1/events/', params={
'id': 'id', 'rank.gt': 85, 'rank_level': '4,5', 'category': 'category', 'country': 'NZ,AU',
'within': '2km@42.346,-71.0432', 'label': 'label1,label2', 'q': 'query',
'place.scope': 'place1,place2', 'place.exact': 'place3',
'start.lt': '2016-04-01T00:00:00.000000', 'start.gte': '2016-03-01T00:00:00.000000', 'start.tz': 'Pacific/Auckland',
'active.lt': '2016-04-01T00:00:00.000000', 'active.gte': '2016-03-01T00:00:00.000000', 'active.tz': 'Pacific/Auckland',
'signal.id': 'zVNLr8tHvWQw', 'signal.explain': '2016-04-01'})

@with_mock_client()
def test_search_params_dicts(self, client):
client.events.search(id="id", q="query", rank_level=[4,5], rank={"gt": 85}, country=["NZ", "AU"],
within={"radius": "2km", "longitude": -71.0432, "latitude": 42.346},
label=["label1", "label2"], category="category",
place={"scope": ["place1", "place2"], "exact": "place3"},
start={"gte": "2016-03-01", "lt": datetime(2016, 4, 1), "tz": "Pacific/Auckland"},
active={"gte": "2016-03-01", "lt": datetime(2016, 4, 1), "tz": "Pacific/Auckland"},
signal={"id": "zVNLr8tHvWQw", "explain": datetime(2016, 4, 1)})

client.request.assert_called_once_with('get', '/v1/events/', params={
'id': 'id', 'rank.gt': 85, 'rank_level': '4,5', 'category': 'category', 'country': 'NZ,AU',
Expand Down

0 comments on commit 2e7afe5

Please sign in to comment.