Skip to content

Commit be25433

Browse files
committed
Merge pull request planetlabs#76 from ischneider/fix-mosaic-quads
fix mosaic-quads when no aoi passed, add test
2 parents 31d071d + cf3c1ca commit be25433

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

planet/scripts/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,10 @@ def get_mosaic_quads(mosaic_name, aoi, limit, pretty):
407407
Get quad info for the specified mosaic
408408
"""
409409
aoi = read_aoi(aoi)
410-
# work around backend limitation of using a FeatureCollection
411-
aoi = api.utils.geometry_from_json(aoi)
410+
411+
if aoi:
412+
# work around backend limitation of using a FeatureCollection
413+
aoi = api.utils.geometry_from_json(aoi)
412414

413415
echo_json_response(
414416
call_and_wrap(client().get_mosaic_quads,

tests/test_cli.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,18 @@ def test_init():
252252
os.unlink(test_file)
253253

254254

255+
def test_mosaic_quads():
256+
response = MagicMock(spec=models.JSON)
257+
response.get_raw.return_value = '{"quads": []}'
258+
259+
client.get_mosaic_quads.return_value = response
260+
result = runner.invoke(scripts.cli, ['mosaic-quads', 'some_mosaic_name'])
261+
assert result.exit_code == 0
262+
assert result.output == '{\n "quads": []\n}\n'
263+
called_with = client.get_mosaic_quads.call_args[0]
264+
assert called_with[0] == 'some_mosaic_name'
265+
266+
255267
def _set_workspace(workspace, *args, **kw):
256268
response = MagicMock(spec=models.JSON)
257269
response.get_raw.return_value = '{"status": "OK"}'

0 commit comments

Comments
 (0)