tmp_path = '/tmp/pytest-of-jenkins/pytest-0/test_cli_deposit_warning_missi2'
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', ...}
caplog = <_pytest.logging.LogCaptureFixture object at 0x7fc0a420b860>
cli_runner = <click.testing.CliRunner object at 0x7fc0a420bac8>
requests_mock_datadir = <requests_mock.mocker.Mocker object at 0x7fc0a291ac18>
def test_cli_deposit_warning_missing_provenance_url(
tmp_path, atom_dataset, caplog, cli_runner, requests_mock_datadir,
):
"""Deposit cli should warn when no metadata provenance is provided
"""
atom_template = atom_dataset["entry-data-with-add-to-origin-no-prov"]
metadata_raw = atom_template % "some-url"
metadata_path = os.path.join(tmp_path, "metadata-with-missing-prov-url.xml")
with open(metadata_path, "w") as f:
f.write(metadata_raw)
# fmt: off
cli_runner.invoke(
cli,
[
"upload",
"--url", "https://deposit.swh.test/1",
"--username", TEST_USER["username"],
"--password", TEST_USER["password"],
"--metadata", metadata_path,
],
)
# fmt: on
count_warnings = sum(
1 for (_, log_level, _) in caplog.record_tuples if log_level == logging.WARNING
)
> assert count_warnings == 1
E assert 0 == 1
E +0
E -1
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/cli/test_client.py:973: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Feb 22 2022, 3:23 PM