def test_url(self, mock_requests): lng = lat = 1.0 map_id = 'fake.map.id' with override_settings(MAPBOX_MAP_ID=map_id): get_first_mapbox_geocode_result('1.0,1.0') expected_url = 'http://api.tiles.mapbox.com/v3/%s/geocode/%s,%s.json' % (map_id, lng, lat) mock_requests.get.assert_called_with(expected_url)
def test_url(self, mock_requests): lng = lat = 1.0 map_id = 'fake.map.id' with override_settings(MAPBOX_MAP_ID=map_id): get_first_mapbox_geocode_result('1.0,1.0') expected_url = 'http://api.tiles.mapbox.com/v3/%s/geocode/%s,%s.json' % ( map_id, lng, lat) mock_requests.get.assert_called_with(expected_url)
def test_raise_on_error(self, mock_requests): mock_requests.get.return_value.raise_for_status.side_effect = HTTPError with self.assertRaises(HTTPError): get_first_mapbox_geocode_result('')