Skip to content

Commit 1f247d7

Browse files
committed
zoom test
1 parent 8c2212d commit 1f247d7

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/test_cli_estimate_cu.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,35 @@ def test_cli_estimate_cu_tileset_with_sources(
9393
result.output
9494
== f"\nEstimated CUs for '{tileset_id}': {msg['cu']}. To publish your tileset, run 'tilesets publish'.\n"
9595
)
96+
97+
@pytest.mark.usefixtures("token_environ")
98+
@pytest.mark.usefixtures("api_environ")
99+
@mock.patch("requests.Session.get")
100+
@mock.patch("glob.glob")
101+
def test_cli_estimate_cu_tileset_with_zoom_overrides(
102+
mock_glob, mock_request_get, MockResponse
103+
):
104+
runner = CliRunner()
105+
106+
tileset_id = "my.tileset"
107+
msg = {"cu": "5"}
108+
109+
mock_request_get.return_value = MockResponse(msg)
110+
mock_glob.return_value = ["myfile.grib2"]
111+
result = runner.invoke(estimate_cu, [tileset_id, "-s", "/my/sources/*.grib2", "--minzoom", 1, "--maxzoom", 6])
112+
mock_request_get.assert_called_with(
113+
f"https://api.mapbox.com/tilesets/v1/{tileset_id}/estimate",
114+
params={
115+
"minzoom": 1,
116+
"maxzoom": 6,
117+
"filesize": 0,
118+
"band_count": 15,
119+
"access_token": "pk.eyJ1IjoidGVzdC11c2VyIn0K",
120+
},
121+
)
122+
123+
assert result.exit_code == 0
124+
assert (
125+
result.output
126+
== f"\nEstimated CUs for '{tileset_id}': {msg['cu']}. To publish your tileset, run 'tilesets publish'.\n"
127+
)

0 commit comments

Comments
 (0)