diff --git a/swh/deposit/cli/client.py b/swh/deposit/cli/client.py --- a/swh/deposit/cli/client.py +++ b/swh/deposit/cli/client.py @@ -213,7 +213,7 @@ "Metadata deposit must be provided for metadata " "deposit (either a filepath or --name and --author)") - if not archive and not metadata: + if not archive and not metadata and partial: raise InputError( 'Please provide an actionable command. See --help for more ' 'information') diff --git a/swh/deposit/tests/cli/test_client.py b/swh/deposit/tests/cli/test_client.py --- a/swh/deposit/tests/cli/test_client.py +++ b/swh/deposit/tests/cli/test_client.py @@ -182,6 +182,7 @@ '--username', TEST_USER['username'], '--password', TEST_USER['password'], '--metadata', metadata_path, + '--partial', ]) assert result.exit_code == 0, result.output @@ -192,9 +193,28 @@ mock_client.deposit_create.assert_called_once_with( archive=None, - collection='softcol', in_progress=False, metadata=metadata_path, + collection='softcol', in_progress=True, metadata=metadata_path, slug=slug) # Clear mocking state caplog.clear() 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)