def test_only_start_keyword_arguments(self): t = Three("api.city.gov") t.request("456", start="03-01-2010") end_date = date.today().strftime("%Y-%m-%dT00:00:00Z") expected = "https://api.city.gov/requests/456.json" params = {"start_date": "2010-03-01T00:00:00Z", "end_date": end_date} req.get.assert_called_with(expected, params=params)
def test_only_start_keyword_arguments(self): t = Three('api.city.gov') t.request('456', start='03-01-2010') end_date = date.today().strftime('%Y-%m-%dT00:00:00Z') expected = 'https://api.city.gov/requests/456.json' params = {'start_date': '2010-03-01T00:00:00Z', 'end_date': end_date} t.session.get.assert_called_with(expected, params=params)
def test_shortened_between_keyword(self): t = Three("api.city.gov") dates = ("03-01-10", "03-05-10") t.request("123", between=dates) expected = "https://api.city.gov/requests/123.json" params = {"start_date": "2010-03-01T00:00:00Z", "end_date": "2010-03-05T00:00:00Z"} req.get.assert_called_with(expected, params=params)
def test_between_can_handle_datetimes(self): t = Three("api.city.gov") dates = (date(2010, 3, 10), date(2010, 3, 15)) t.request("123", between=dates) expected = "https://api.city.gov/requests/123.json" params = {"start_date": "2010-03-10T00:00:00Z", "end_date": "2010-03-15T00:00:00Z"} req.get.assert_called_with(expected, params=params)
def test_between_keyword_argument(self): t = Three('api.city.gov') t.request('789', between=['03-01-2010', '03-05-2010']) expected = 'https://api.city.gov/requests/789.json' params = { 'start_date': '2010-03-01T00:00:00Z', 'end_date': '2010-03-05T00:00:00Z' } t.session.get.assert_called_with(expected, params=params)
def test_start_and_end_keyword_arguments(self): t = Three('api.city.gov') t.request('456', start='03-01-2010', end='03-05-2010') expected = 'https://api.city.gov/requests/456.json' params = { 'start_date': '2010-03-01T00:00:00Z', 'end_date': '2010-03-05T00:00:00Z' } t.session.get.assert_called_with(expected, params=params)
def test_only_start_keyword_arguments(self): t = Three('api.city.gov') t.request('456', start='03-01-2010') end_date = date.today().strftime('%Y-%m-%dT00:00:00Z') expected = 'https://api.city.gov/requests/456.json' params = { 'start_date': '2010-03-01T00:00:00Z', 'end_date': end_date } t.session.get.assert_called_with(expected, params=params)
def test_shortened_between_keyword(self): t = Three('api.city.gov') dates = ('03-01-10', '03-05-10') t.request('123', between=dates) expected = 'https://api.city.gov/requests/123.json' params = { 'start_date': '2010-03-01T00:00:00Z', 'end_date': '2010-03-05T00:00:00Z' } t.session.get.assert_called_with(expected, params=params)
def test_between_can_handle_datetimes(self): t = Three('api.city.gov') dates = (date(2010, 3, 10), date(2010, 3, 15)) t.request('123', between=dates) expected = 'https://api.city.gov/requests/123.json' params = { 'start_date': '2010-03-10T00:00:00Z', 'end_date': '2010-03-15T00:00:00Z' } t.session.get.assert_called_with(expected, params=params)
def test_getting_a_specific_request(self): t = Three('api.city.gov') t.request('123') expected = 'https://api.city.gov/requests/123.json' t.session.get.assert_called_with(expected, params={})
def test_between_keyword_argument(self): t = Three("api.city.gov") t.request("789", between=["03-01-2010", "03-05-2010"]) expected = "https://api.city.gov/requests/789.json" params = {"start_date": "2010-03-01T00:00:00Z", "end_date": "2010-03-05T00:00:00Z"} req.get.assert_called_with(expected, params=params)
def test_start_and_end_keyword_arguments(self): t = Three("api.city.gov") t.request("456", start="03-01-2010", end="03-05-2010") expected = "https://api.city.gov/requests/456.json" params = {"start_date": "2010-03-01T00:00:00Z", "end_date": "2010-03-05T00:00:00Z"} req.get.assert_called_with(expected, params=params)
def test_getting_a_specific_request(self): t = Three("api.city.gov") t.request("123") expected = "https://api.city.gov/requests/123.json" req.get.assert_called_with(expected, params={})