Skip to content

Commit

Permalink
rename .tilesets to .list for consistency
Browse files Browse the repository at this point in the history
other services in this SDK use `.list()`, in particular `Datasets` and
`Uploads`
  • Loading branch information
igor47 committed Jul 30, 2019
1 parent a58a11a commit f789ec2
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions docs/tilesets.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ Instantiate `Tilesets`.
>>> tilesets = Tilesets()
```

Call the `list_tilesets` method, passing in values for optional arguments as necessary - `tileset_type`, `visibility`, `sortby`, and `limit`.
Call the `list` method, passing in values for optional arguments as necessary - `tileset_type`, `visibility`, `sortby`, and `limit`.

```python
>>> response = tilesets.list_tilesets()
>>> response = tilesets.list()
```

Evaluate whether the request succeeded, and retrieve the tileset object from the response object.
Expand Down
4 changes: 2 additions & 2 deletions mapbox/services/tilesets.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def base_uri(self):
self.host,
self.api_name,
self.api_version
)
)

def _validate_tileset_type(self, tileset_type):
"""Validates tileset type, raising error if invalid."""
Expand Down Expand Up @@ -104,7 +104,7 @@ def _validate_limit(self, limit):

return limit

def tilesets(self, tileset_type=None, visibility=None,
def list(self, tileset_type=None, visibility=None,
sortby=None, limit=None):
"""Lists all tilesets for an account.
Expand Down
46 changes: 23 additions & 23 deletions tests/test_tilesets.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from base64 import b64encode

from pytest import (
mark,
mark,
raises
)

Expand Down Expand Up @@ -97,7 +97,7 @@ def test_validate_limit_valid(limit):


@activate
def test_tilesets():
def test_list():
add(
method=GET,
url="https://api.mapbox.com" +
Expand All @@ -110,13 +110,13 @@ def test_tilesets():
)

tilesets = Tilesets(access_token=ACCESS_TOKEN)
response = tilesets.tilesets()
response = tilesets.list()
assert response.status_code == 200


@activate
@mark.parametrize("tileset_type", ["raster", "vector"])
def test_tilesets_with_tileset_type(tileset_type):
def test_list_with_tileset_type(tileset_type):
add(
method=GET,
url="https://api.mapbox.com" +
Expand All @@ -130,13 +130,13 @@ def test_tilesets_with_tileset_type(tileset_type):
)

tilesets = Tilesets(access_token=ACCESS_TOKEN)
response = tilesets.tilesets(tileset_type=tileset_type)
response = tilesets.list(tileset_type=tileset_type)
assert response.status_code == 200


@activate
@mark.parametrize("visibility", ["private", "public"])
def test_tilesets_with_visibility(visibility):
def test_list_with_visibility(visibility):
add(
method=GET,
url="https://api.mapbox.com" +
Expand All @@ -150,13 +150,13 @@ def test_tilesets_with_visibility(visibility):
)

tilesets = Tilesets(access_token=ACCESS_TOKEN)
response = tilesets.tilesets(visibility=visibility)
response = tilesets.list(visibility=visibility)
assert response.status_code == 200


@activate
@mark.parametrize("sortby", ["created", "modified"])
def test_tilesets_with_sortby(sortby):
def test_list_with_sortby(sortby):
add(
method=GET,
url="https://api.mapbox.com" +
Expand All @@ -170,13 +170,13 @@ def test_tilesets_with_sortby(sortby):
)

tilesets = Tilesets(access_token=ACCESS_TOKEN)
response = tilesets.tilesets(sortby=sortby)
response = tilesets.list(sortby=sortby)
assert response.status_code == 200


@activate
@mark.parametrize("limit", [1, 250, 500])
def test_tilesets_with_limit(limit):
def test_list_with_limit(limit):
add(
method=GET,
url="https://api.mapbox.com" +
Expand All @@ -190,12 +190,12 @@ def test_tilesets_with_limit(limit):
)

tilesets = Tilesets(access_token=ACCESS_TOKEN)
response = tilesets.tilesets(limit=limit)
response = tilesets.list(limit=limit)
assert response.status_code == 200


@activate
def test_tilesets_with_tileset_type_and_visibility():
def test_list_with_tileset_type_and_visibility():
add(
method=GET,
url="https://api.mapbox.com" +
Expand All @@ -210,12 +210,12 @@ def test_tilesets_with_tileset_type_and_visibility():
)

tilesets = Tilesets(access_token=ACCESS_TOKEN)
response = tilesets.tilesets(tileset_type="vector", visibility="public")
response = tilesets.list(tileset_type="vector", visibility="public")
assert response.status_code == 200


@activate
def test_tilesets_with_tileset_type_and_sortby():
def test_list_with_tileset_type_and_sortby():
add(
method=GET,
url="https://api.mapbox.com" +
Expand All @@ -230,12 +230,12 @@ def test_tilesets_with_tileset_type_and_sortby():
)

tilesets = Tilesets(access_token=ACCESS_TOKEN)
response = tilesets.tilesets(tileset_type="vector", sortby="created")
response = tilesets.list(tileset_type="vector", sortby="created")
assert response.status_code == 200


@activate
def test_tilesets_with_tileset_type_and_limit():
def test_list_with_tileset_type_and_limit():
add(
method=GET,
url="https://api.mapbox.com" +
Expand All @@ -250,12 +250,12 @@ def test_tilesets_with_tileset_type_and_limit():
)

tilesets = Tilesets(access_token=ACCESS_TOKEN)
response = tilesets.tilesets(tileset_type="vector", limit=500)
response = tilesets.list(tileset_type="vector", limit=500)
assert response.status_code == 200


@activate
def test_tilesets_with_visibility_and_sortby():
def test_list_with_visibility_and_sortby():
add(
method=GET,
url="https://api.mapbox.com" +
Expand All @@ -270,12 +270,12 @@ def test_tilesets_with_visibility_and_sortby():
)

tilesets = Tilesets(access_token=ACCESS_TOKEN)
response = tilesets.tilesets(visibility="public", sortby="created")
response = tilesets.list(visibility="public", sortby="created")
assert response.status_code == 200


@activate
def test_tilesets_with_visibility_and_limit():
def test_list_with_visibility_and_limit():
add(
method=GET,
url="https://api.mapbox.com" +
Expand All @@ -290,12 +290,12 @@ def test_tilesets_with_visibility_and_limit():
)

tilesets = Tilesets(access_token=ACCESS_TOKEN)
response = tilesets.tilesets(visibility="public", limit=500)
response = tilesets.list(visibility="public", limit=500)
assert response.status_code == 200


@activate
def test_tilesets_with_sortby_and_limit():
def test_list_with_sortby_and_limit():
add(
method=GET,
url="https://api.mapbox.com" +
Expand All @@ -309,5 +309,5 @@ def test_tilesets_with_sortby_and_limit():
)

tilesets = Tilesets(access_token=ACCESS_TOKEN)
response = tilesets.tilesets(sortby="created", limit=500)
response = tilesets.list(sortby="created", limit=500)
assert response.status_code == 200

0 comments on commit f789ec2

Please sign in to comment.