datadir = '/var/lib/jenkins/workspace/DDEP/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/cli/../data'
requests_mock_datadir = <requests_mock.mocker.Mocker object at 0x7f735af958d0>
cli_runner = <click.testing.CliRunner object at 0x7f735b70eeb8>
atom_dataset = {'codemeta-sample': '<?xml version="1.0"?>\n <entry xmlns="http://www.w3.org/2005/Atom"\n xmlns:d...ntry>\n', 'entry-data-empty-body': '<?xml version="1.0"?>\n<entry xmlns="http://www.w3.org/2005/Atom"></entry>\n', ...}
tmp_path = '/tmp/pytest-of-jenkins/pytest-0/test_cli_metadata_only_deposit0'
def test_cli_metadata_only_deposit(
datadir, requests_mock_datadir, cli_runner, atom_dataset, tmp_path,
):
"""Update new metadata on a completed deposit (status done) is ok
"""
deposit_id = 100
swhid = "swh:1:dir:ef04a768181417fbc5eef4243e2507915f24deea"
# write metadata to disk
metadata = atom_dataset["entry-data-with-swhid"].format(swhid=swhid)
metadata_path = os.path.join(tmp_path, "entry-data-with-swhid.xml")
with open(metadata_path, "w") as f:
f.write(metadata)
api_url_basename = "deposit.test.metadataonly"
expected_deposit_status = {
"deposit_external_id": "check-deposit-2020-10-08T13:52:34.509655",
"deposit_id": str(deposit_id),
"deposit_status": "done",
"deposit_status_detail": (
"The deposit has been successfully loaded into the "
"Software Heritage archive"
),
"deposit_swh_id": swhid,
"deposit_swh_id_context": f"${swhid};origin=https://www.softwareheritage.org/check-deposit-2020-10-08T13:52:34.509655;visit=swh:1:snp:c477c6ef51833127b13a86ece7d75e5b3cc4e93d;anchor=swh:1:rev:f26f3960c175f15f6e24200171d446b86f6f7230;path=/", # noqa
}
assert expected_deposit_status["deposit_status"] == "done"
assert expected_deposit_status["deposit_swh_id"] is not None
# fmt: off
result = cli_runner.invoke(
cli,
[
"metadata-only",
"--url", f"https://{api_url_basename}/1",
"--username", TEST_USER["username"],
"--password", TEST_USER["password"],
"--swhid", swhid,
"--metadata", metadata_path,
"--format", "json",
],
)
# fmt: on
> assert result.exit_code == 0, result.output
E AssertionError: Usage: deposit [OPTIONS] COMMAND [ARGS]...
E Try 'deposit -h' for help.
E
E Error: No such command 'metadata-only'.
E
E assert 2 == 0
E +2
E -0
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/cli/test_client.py:687: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Dec 14 2020, 5:38 PM