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_deposit_with_server_d0/tmponmpnnvt', 'length': 128, 'md5sum': '3ab21f857791efdc5e9a97fa565e99ac', ...}
caplog = <_pytest.logging.LogCaptureFixture object at 0x7fc0a2882908>
client_mock_api_down = <MagicMock id='140465354260040'>
slug = 'd8993c00-b9da-4f75-9630-3b5d810b91f7'
patched_tmp_path = '/tmp/pytest-of-jenkins/pytest-0/test_cli_deposit_with_server_d0'
cli_runner = <click.testing.CliRunner object at 0x7fc0a27214a8>
def test_cli_deposit_with_server_down_for_maintenance(
sample_archive, caplog, client_mock_api_down, slug, patched_tmp_path, cli_runner
):
""" Deposit failure due to maintenance down time should be explicit
"""
# 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",
],
)
# fmt: on
assert result.exit_code == 1, result.output
assert result.output == ""
down_for_maintenance_log_record = (
"swh.deposit.cli.client",
logging.ERROR,
"Database backend maintenance: Temporarily unavailable, try again later.",
)
> assert down_for_maintenance_log_record in caplog.record_tuples
E assert ('swh.deposit.cli.client', 40, 'Database backend maintenance: Temporarily unavailable, try again later.') 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 0x7fc0a2882908>.record_tuples
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/cli/test_client.py:168: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Feb 22 2022, 3:23 PM