Skip to content

Commit 01f87ed

Browse files
committed
bands test
1 parent fb63661 commit 01f87ed

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

tests/test_cli_estimate_cu.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,49 @@ def test_cli_estimate_cu_tileset_with_zoom_overrides(
129129
result.output
130130
== f"\nEstimated CUs for '{tileset_id}': {msg['cu']}. To publish your tileset, run 'tilesets publish'.\n"
131131
)
132+
133+
134+
@pytest.mark.usefixtures("token_environ")
135+
@pytest.mark.usefixtures("api_environ")
136+
@mock.patch("requests.Session.get")
137+
@mock.patch("glob.glob")
138+
def test_cli_estimate_cu_tileset_with_bands_override(
139+
mock_glob, mock_request_get, MockResponse
140+
):
141+
runner = CliRunner()
142+
143+
tileset_id = "my.tileset"
144+
msg = {"cu": "5"}
145+
146+
mock_request_get.return_value = MockResponse(msg)
147+
mock_glob.return_value = ["myfile.grib2"]
148+
result = runner.invoke(
149+
estimate_cu,
150+
[
151+
tileset_id,
152+
"-s",
153+
"/my/sources/*.grib2",
154+
"-b",
155+
10,
156+
"--minzoom",
157+
1,
158+
"--maxzoom",
159+
6,
160+
],
161+
)
162+
mock_request_get.assert_called_with(
163+
f"https://api.mapbox.com/tilesets/v1/{tileset_id}/estimate",
164+
params={
165+
"minzoom": 1,
166+
"maxzoom": 6,
167+
"filesize": 0,
168+
"band_count": 10,
169+
"access_token": "pk.eyJ1IjoidGVzdC11c2VyIn0K",
170+
},
171+
)
172+
173+
assert result.exit_code == 0
174+
assert (
175+
result.output
176+
== f"\nEstimated CUs for '{tileset_id}': {msg['cu']}. To publish your tileset, run 'tilesets publish'.\n"
177+
)

0 commit comments

Comments
 (0)