Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/tests/cli/test_client.py
Show First 20 Lines • Show All 175 Lines • ▼ Show 20 Lines | def test_multisteps_deposit( | ||||
metadata_path = os.path.join( | metadata_path = os.path.join( | ||||
datadir, 'atom', 'entry-data-deposit-binary.xml') | datadir, 'atom', 'entry-data-deposit-binary.xml') | ||||
result = runner.invoke(cli, [ | result = runner.invoke(cli, [ | ||||
'upload', | 'upload', | ||||
'--url', 'mock://deposit.swh/1', | '--url', 'mock://deposit.swh/1', | ||||
'--username', TEST_USER['username'], | '--username', TEST_USER['username'], | ||||
'--password', TEST_USER['password'], | '--password', TEST_USER['password'], | ||||
'--metadata', metadata_path, | '--metadata', metadata_path, | ||||
ardumont: Same as slug/external_id shenanigans.
We have 2 terms for the same meaning, partial and in… | |||||
'--partial', | |||||
]) | ]) | ||||
assert result.exit_code == 0, result.output | assert result.exit_code == 0, result.output | ||||
assert result.output == '' | assert result.output == '' | ||||
assert caplog.record_tuples == [ | assert caplog.record_tuples == [ | ||||
('swh.deposit.cli.client', logging.INFO, '{"deposit_id": "42"}'), | ('swh.deposit.cli.client', logging.INFO, '{"deposit_id": "42"}'), | ||||
] | ] | ||||
mock_client.deposit_create.assert_called_once_with( | mock_client.deposit_create.assert_called_once_with( | ||||
archive=None, | archive=None, | ||||
collection='softcol', in_progress=False, metadata=metadata_path, | collection='softcol', in_progress=True, metadata=metadata_path, | ||||
slug=slug) | slug=slug) | ||||
# Clear mocking state | # Clear mocking state | ||||
caplog.clear() | caplog.clear() | ||||
mock_client.reset_mock() | mock_client.reset_mock() | ||||
# https://docs.softwareheritage.org/devel/swh-deposit/getting-started.html#finalize-deposit | |||||
result = runner.invoke(cli, [ | |||||
'upload', | |||||
'--url', 'mock://deposit.swh/1', | |||||
'--username', TEST_USER['username'], | |||||
'--password', TEST_USER['password'], | |||||
]) | |||||
assert result.exit_code == 0, result.output | |||||
assert result.output == '' | |||||
assert caplog.record_tuples == [ | |||||
('swh.deposit.cli.client', logging.INFO, '{"deposit_id": "42"}'), | |||||
] | |||||
mock_client.deposit_create.assert_called_once_with( | |||||
archive=None, | |||||
collection='softcol', in_progress=False, metadata=None, | |||||
slug=slug) |
Same as slug/external_id shenanigans.
We have 2 terms for the same meaning, partial and in-progress deposit are the same thing.
Maybe we should think about unifying this once and for all as partial (choosing partial here because 1. it's shorter 2. it's public facing).
Again, not for now ;)