sample_archive = {'data': b'PK\x03\x04\x14\x00\x00\x00\x00\x00\xf5vtQ\xcba\xb4c\x14\x00\x00\x00\x14\x00\x00\x00\x05\x00\x00\x00file1som...ytest-0/test_cli_single_minimal_deposi0/tmpvluvyauj', 'length': 128, 'md5sum': '0a3c3f08d30be2a7d8998c6ee5bcc77b', ...}
slug = '37c314b1-884c-4866-aade-742a97cc6074'
patched_tmp_path = '/tmp/pytest-of-jenkins/pytest-0/test_cli_single_minimal_deposi0'
requests_mock_datadir = <requests_mock.mocker.Mocker object at 0x7f2d37f3a898>
cli_runner = <click.testing.CliRunner object at 0x7f2d37f7b940>
def test_cli_single_minimal_deposit(
sample_archive, slug, patched_tmp_path, requests_mock_datadir, cli_runner
):
""" This ensure a single deposit upload through the cli is fine, cf.
https://docs.softwareheritage.org/devel/swh-deposit/getting-started.html#single-deposit
""" # noqa
metadata_path = os.path.join(patched_tmp_path, "metadata.xml")
# fmt: off
result = cli_runner.invoke(
cli,
[
"upload",
"--url", "https://deposit.swh.test/1",
"--username", TEST_USER["username"],
"--password", TEST_USER["password"],
"--name", "test-project",
"--archive", sample_archive["path"],
"--author", "Jane Doe",
"--slug", slug,
"--format", "json",
],
)
# fmt: on
assert result.exit_code == 0, result.output
assert json.loads(result.output) == {
"deposit_id": "615",
"deposit_status": "partial",
"deposit_status_detail": None,
"deposit_date": "Oct. 8, 2020, 4:57 p.m.",
}
with open(metadata_path) as fd:
actual_metadata = dict(parse_xml(fd.read()))
> assert actual_metadata["atom:author"] == TEST_USER["username"]
E KeyError: 'atom:author'
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/cli/test_client.py:188: KeyError
TEST RESULT
TEST RESULT
- Run At
- Nov 20 2020, 3:55 PM