Page MenuHomeSoftware Heritage

Jenkins > .tox.py3.lib.python3.7.site-packages.swh.deposit.tests.cli.test_client::test_cli_multisteps_deposit
Failed

TEST RESULT

Run At
Feb 22 2022, 3:23 PM
Details
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...s/pytest-0/test_cli_multisteps_deposit0/tmpl9w7g6v2', 'length': 128, 'md5sum': '3ab21f857791efdc5e9a97fa565e99ac', ...} datadir = '/var/lib/jenkins/workspace/DDEP/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/cli/../data' slug = 'e69437a8-1dfb-496f-ace8-3142b7ee4cd6' requests_mock_datadir = <requests_mock.mocker.Mocker object at 0x7fc0a2891668> cli_runner = <click.testing.CliRunner object at 0x7fc0a2891a90> def test_cli_multisteps_deposit( sample_archive, datadir, slug, requests_mock_datadir, cli_runner ): """ First deposit a partial deposit (no metadata, only archive), then update the metadata part. https://docs.softwareheritage.org/devel/swh-deposit/getting-started.html#multisteps-deposit """ # noqa api_url = "https://deposit.test.metadata/1" deposit_id = 666 # Create a partial deposit with only 1 archive # fmt: off result = cli_runner.invoke( cli, [ "upload", "--url", api_url, "--username", TEST_USER["username"], "--password", TEST_USER["password"], "--archive", sample_archive["path"], "--slug", slug, "--format", "json", "--partial", ], ) # fmt: on assert result.exit_code == 0, f"unexpected output: {result.output}" actual_deposit = json.loads(result.output) assert actual_deposit == { "deposit_id": str(deposit_id), "deposit_status": "partial", "deposit_status_detail": None, "deposit_date": "Oct. 8, 2020, 4:57 p.m.", } # Update the partial deposit with only 1 archive # fmt: off result = cli_runner.invoke( cli, [ "upload", "--url", api_url, "--username", TEST_USER["username"], "--password", TEST_USER["password"], "--archive", sample_archive["path"], "--deposit-id", deposit_id, "--slug", slug, "--format", "json", "--partial", # in-progress: True, because remains the metadata to upload ], ) # fmt: on assert result.exit_code == 0, f"unexpected output: {result.output}" assert result.output is not None actual_deposit = json.loads(result.output) # deposit update scenario actually returns a deposit status dict assert actual_deposit["deposit_id"] == str(deposit_id) assert actual_deposit["deposit_status"] == "partial" # Update the partial deposit with only some metadata (and then finalize it) # https://docs.softwareheritage.org/devel/swh-deposit/getting-started.html#add-content-or-metadata-to-the-deposit metadata_path = os.path.join(datadir, "atom", "entry-data-deposit-binary.xml") # Update deposit with metadata # fmt: off result = cli_runner.invoke( cli, [ "upload", "--url", api_url, "--username", TEST_USER["username"], "--password", TEST_USER["password"], "--metadata", metadata_path, "--deposit-id", deposit_id, "--slug", slug, "--format", "json", ], # this time, ^ we no longer flag it to partial, so the status changes to # in-progress false ) # fmt: on > assert result.exit_code == 0, f"unexpected output: {result.output}" E AssertionError: unexpected output: E assert 1 == 0 E +1 E -0 .tox/py3/lib/python3.7/site-packages/swh/deposit/tests/cli/test_client.py:657: AssertionError