sample_archive = {'data': b'PK\x03\x04\x14\x00\x00\x00\x00\x00\xe4rVT\xcba\xb4c\x14\x00\x00\x00\x14\x00\x00\x00\x05\x00\x00\x00file1som...ytest-0/test_cli_validation_replace_wi0/tmp50vnng20', 'length': 128, 'md5sum': '3ab21f857791efdc5e9a97fa565e99ac', ...}
caplog = <_pytest.logging.LogCaptureFixture object at 0x7fc0a2e71320>
patched_tmp_path = '/tmp/pytest-of-jenkins/pytest-0/test_cli_validation_replace_wi0'
requests_mock_datadir = <requests_mock.mocker.Mocker object at 0x7fc0a3a89780>
datadir = '/var/lib/jenkins/workspace/DDEP/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/cli/../data'
cli_runner = <click.testing.CliRunner object at 0x7fc0a2782b00>
def test_cli_validation_replace_with_no_deposit_id_fails(
sample_archive, caplog, patched_tmp_path, requests_mock_datadir, datadir, cli_runner
):
"""--replace flags require --deposit-id otherwise fails
"""
metadata_path = os.path.join(datadir, "atom", "entry-data-deposit-binary.xml")
# fmt: off
result = cli_runner.invoke(
cli,
[
"upload",
"--url", "https://deposit.swh.test/1",
"--username", TEST_USER["username"],
"--password", TEST_USER["password"],
"--metadata", metadata_path,
"--archive", sample_archive["path"],
"--replace",
],
)
# fmt: on
assert result.exit_code == 1, result.output
assert result.output == ""
expected_error_log_record = (
"swh.deposit.cli.client",
logging.ERROR,
(
"Problem during parsing options: "
"To update an existing deposit, you must provide its id"
),
)
> assert expected_error_log_record in caplog.record_tuples
E assert ('swh.deposit.cli.client', 40, 'Problem during parsing options: To update an existing deposit, you must provide its id') in [('swh.deposit.cli.client', 30, 'The metadata file provided should contain "<swh:create_origin>" or "<swh:add_to_origin>" tag')]
E + where [('swh.deposit.cli.client', 30, 'The metadata file provided should contain "<swh:create_origin>" or "<swh:add_to_origin>" tag')] = <_pytest.logging.LogCaptureFixture object at 0x7fc0a2e71320>.record_tuples
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/cli/test_client.py:537: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Feb 22 2022, 3:23 PM