Example #1
0
 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)
Example #2
0
 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)
Example #3
0
 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)
Example #4
0
 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)
Example #5
0
 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)
Example #6
0
 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)
Example #7
0
 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)
Example #8
0
 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)
Example #9
0
 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)
Example #10
0
 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)
Example #11
0
 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)
Example #12
0
 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)
Example #13
0
 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)
Example #14
0
 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={})
Example #15
0
 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)
Example #16
0
 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)
Example #17
0
 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={})
Example #18
0
 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={})