def test_tilequery_with_radius_limit_dedupe_geometry_and_layers(): add( method=GET, url="https://api.mapbox.com" + "/v4" + "/mapbox.mapbox-streets-v8" + "/tilequery" + "/0.0,1.1.json" + "?access_token=pk.test" + "&radius=25" + "&limit=25" + "&dedupe=true" + "&geometry=linestring" + "&layers=layer0,layer1%2Clayer2", match_querystring=True, body='{"key": "value"}', status=200, ) tilequery = Tilequery(access_token="pk.test") response = tilequery.tilequery( "mapbox.mapbox-streets-v8", lon=0.0, lat=1.1, radius=25, limit=25, dedupe=True, geometry="linestring", layers=["layer0", "layer1", "layer2"], ) assert response.status_code == 200
def test_object_properties(): tilequery = Tilequery() assert tilequery.api_name assert tilequery.api_version assert tilequery.valid_geometries assert tilequery.base_uri
def test_tilequery_one_mapid(): add( method=GET, url="https://api.mapbox.com" + "/v4" + "/mapbox.mapbox-streets-v8" + "/tilequery" + "/0.0,1.1.json" + "?access_token=pk.test", match_querystring=True, body='{"key": "value"}', status=200, ) tilequery = Tilequery(access_token="pk.test") response = tilequery.tilequery("mapbox.mapbox-streets-v8", lon=0.0, lat=1.1) assert response.status_code == 200
def test_tilequery_with_radius_and_geometry(): add( method=GET, url="https://api.mapbox.com" + "/v4" + "/mapbox.mapbox-streets-v8" + "/tilequery" + "/0.0,1.1.json" + "?access_token=pk.test" + "&radius=25" + "&geometry=linestring", match_querystring=True, body='{"key": "value"}', status=200, ) tilequery = Tilequery(access_token="pk.test") response = tilequery.tilequery("mapbox.mapbox-streets-v8", lon=0.0, lat=1.1, radius=25, geometry="linestring") assert response.status_code == 200
def test_validate_radius_geometry(geometry): tilequery = Tilequery() result = tilequery._validate_geometry(geometry) assert result == geometry
def test_validate_geometry_invalid(): tilequery = Tilequery() with raises(InvalidParameterError): tilequery._validate_geometry("invalid")
def test_validate_limit_valid(limit): tilequery = Tilequery() result = tilequery._validate_limit(limit) assert result == limit
def test_validate_limit_invalid(limit): tilequery = Tilequery() with raises(InvalidParameterError): tilequery._validate_limit(limit)
def test_validate_radius_valid(radius): tilequery = Tilequery() result = tilequery._validate_radius(radius) assert result == radius
def test_validate_radius_invalid(): tilequery = Tilequery() with raises(InvalidParameterError): tilequery._validate_radius(-1)
def test_validate_lat_valid(lat): tilequery = Tilequery() result = tilequery._validate_lat(lat) assert result == lat
def test_validate_lat_invalid(lat): tilequery = Tilequery() with raises(InvalidCoordError): tilequery._validate_lat(lat)
def test_validate_lon_valid(lon): tilequery = Tilequery() result = tilequery._validate_lon(lon) assert result == lon
def test_validate_lon_invalid(lon): tilequery = Tilequery() with raises(InvalidCoordError): tilequery._validate_lon(lon)