Skip to content

Commit 9a9b5a7

Browse files
authored
feat: add support for the rasterarray type on the list command. (#181)
1 parent 561f295 commit 9a9b5a7

File tree

6 files changed

+11
-25
lines changed

6 files changed

+11
-25
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ __pycache__/
88
# Distribution / packaging
99
.Python
1010
env/
11+
venv/
1112
build/
1213
develop-eggs/
1314
dist/

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
=======
44

5+
# 1.10.0 (2024-05-07)
6+
- Add support for the `rasterarray` type on the `list` command.
7+
58
# 1.9.3 (2023-06-27)
69
- Beautified error messages
710

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ tilesets list <username>
391391

392392
Flags:
393393

394-
- `--type [vector|raster]` [optional]: filter results by tileset type
394+
- `--type [vector|raster|rasterarray]` [optional]: filter results by tileset type
395395
- `--visibility [public|private]` [optional]: filter results by visibility
396396
- `--sortby [created|modified]` [optional]: sort results by their `created` or `modified` timestamps
397397
- `--limit [1-500]` [optional]: the maximum number of results to return, from 1 to 500. The default is 100.

mapbox_tilesets/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""mapbox_tilesets package"""
22

3-
__version__ = "1.9.3"
3+
__version__ = "1.10.0"

mapbox_tilesets/scripts/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ def job(tileset, job_id, token=None, indent=None):
362362
@click.option(
363363
"--type",
364364
required=False,
365-
type=click.Choice(["vector", "raster"]),
365+
type=click.Choice(["vector", "raster", "rasterarray"]),
366366
help="Filter results by tileset type",
367367
)
368368
@click.option(

tests/test_cli_list.py

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ def test_cli_list_bad_token(mock_request_get, MockResponse):
6767

6868
@pytest.mark.usefixtures("token_environ")
6969
@mock.patch("requests.Session.get")
70-
def test_cli_list_type_vector(mock_request_get, MockResponse):
70+
@pytest.mark.parametrize("type", ["vector", "raster", "rasterarray"])
71+
def test_cli_list_type(mock_request_get, MockResponse, type):
7172
runner = CliRunner()
7273

7374
message = [
@@ -76,28 +77,9 @@ def test_cli_list_type_vector(mock_request_get, MockResponse):
7677
]
7778

7879
mock_request_get.return_value = MockResponse(message)
79-
result = runner.invoke(list, ["test", "--type", "vector"])
80+
result = runner.invoke(list, ["test", "--type", type])
8081
mock_request_get.assert_called_with(
81-
"https://api.mapbox.com/tilesets/v1/test?access_token=pk.eyJ1IjoidGVzdC11c2VyIn0K&limit=100&type=vector"
82-
)
83-
assert result.exit_code == 0
84-
assert result.output == """test.tileset-1\ntest.tileset-2\n"""
85-
86-
87-
@pytest.mark.usefixtures("token_environ")
88-
@mock.patch("requests.Session.get")
89-
def test_cli_list_type_raster(mock_request_get, MockResponse):
90-
runner = CliRunner()
91-
92-
message = [
93-
{"id": "test.tileset-1", "something": "beep"},
94-
{"id": "test.tileset-2", "something": "boop"},
95-
]
96-
97-
mock_request_get.return_value = MockResponse(message)
98-
result = runner.invoke(list, ["test", "--type", "raster"])
99-
mock_request_get.assert_called_with(
100-
"https://api.mapbox.com/tilesets/v1/test?access_token=pk.eyJ1IjoidGVzdC11c2VyIn0K&limit=100&type=raster"
82+
f"https://api.mapbox.com/tilesets/v1/test?access_token=pk.eyJ1IjoidGVzdC11c2VyIn0K&limit=100&type={type}"
10183
)
10284
assert result.exit_code == 0
10385
assert result.output == """test.tileset-1\ntest.tileset-2\n"""

0 commit comments

Comments
 (0)