Skip to content

Commit d4318b5

Browse files
committed
fix and re-enable planet orders download checksum test
1 parent 2bf4cf5 commit d4318b5

File tree

1 file changed

+11
-21
lines changed

1 file changed

+11
-21
lines changed

tests/integration/test_orders_cli.py

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,13 @@ def _func():
258258

259259
order_description['_links']['results'] = [{
260260
'location': dl_url1,
261-
'name': 'oid/itemtype/m1.json'
261+
'name': f'{oid}/itemtype/m1.json'
262262
}, {
263263
'location': dl_url2,
264-
'name': 'oid/itemtype/m2.json'
264+
'name': f'{oid}/itemtype/m2.json'
265265
}, {
266266
'location': dl_url3,
267-
'name': 'oid/manifest.json'
267+
'name': f'{oid}/manifest.json'
268268
}] # yapf: disable
269269

270270
get_url = f'{TEST_ORDERS_URL}/{oid}'
@@ -334,32 +334,22 @@ def test_cli_orders_download_default(invoke, mock_download_response, oid):
334334
assert 'm1.json' in result.output
335335

336336
# Check that the files were downloaded and have the correct contents
337-
with open(Path(folder) / 'oid/itemtype/m1.json') as f:
337+
with open(Path(folder) / f'{oid}/itemtype/m1.json') as f:
338338
assert json.load(f) == {'key': 'value'}
339-
with open(Path(folder) / 'oid/itemtype/m2.json') as f:
339+
with open(Path(folder) / f'{oid}/itemtype/m2.json') as f:
340340
assert json.load(f) == {'key2': 'value2'}
341341

342342

343343
@respx.mock
344-
@pytest.mark.skip("""does not actually test checksum, copy of
345-
test_cli_orders_download_default""")
346344
def test_cli_orders_download_checksum(invoke, mock_download_response, oid):
345+
'''checksum is successful'''
347346
mock_download_response()
348347

349348
runner = CliRunner()
350-
with runner.isolated_filesystem() as folder:
351-
result = invoke(['download', oid], runner=runner)
349+
with runner.isolated_filesystem():
350+
result = invoke(['download', oid, '--checksum=MD5'], runner=runner)
352351
assert result.exit_code == 0
353352

354-
# basic check of progress reporting
355-
assert 'm1.json' in result.output
356-
357-
# Check that the files were downloaded and have the correct contents
358-
with open(Path(folder) / 'oid/itemtype/m1.json') as f:
359-
assert json.load(f) == {'key': 'value'}
360-
with open(Path(folder) / 'oid/itemtype/m2.json') as f:
361-
assert json.load(f) == {'key2': 'value2'}
362-
363353

364354
@respx.mock
365355
def test_cli_orders_download_dest(invoke, mock_download_response, oid):
@@ -374,10 +364,10 @@ def test_cli_orders_download_dest(invoke, mock_download_response, oid):
374364
assert result.exit_code == 0
375365

376366
# Check that the files were downloaded to the custom directory
377-
with open(dest_dir / 'oid/itemtype/m1.json') as f:
367+
with open(dest_dir / f'{oid}/itemtype/m1.json') as f:
378368
assert json.load(f) == {'key': 'value'}
379369

380-
with open(dest_dir / 'oid/itemtype/m2.json') as f:
370+
with open(dest_dir / f'{oid}/itemtype/m2.json') as f:
381371
assert json.load(f) == {'key2': 'value2'}
382372

383373

@@ -390,7 +380,7 @@ def test_cli_orders_download_overwrite(invoke,
390380

391381
runner = CliRunner()
392382
with runner.isolated_filesystem() as folder:
393-
filepath = Path(folder) / 'oid/itemtype/m1.json'
383+
filepath = Path(folder) / f'{oid}/itemtype/m1.json'
394384
filepath.parent.mkdir(parents=True)
395385
filepath.write_text(json.dumps({'foo': 'bar'}))
396386

0 commit comments

Comments
 (0)