api_client = <rest_framework.test.APIClient object at 0x7f0dde98d908>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f0dde98de10>
@given(directory(), revision())
> def test_api_vault_cook(api_client, mocker, directory, revision):
.tox/py3/lib/python3.7/site-packages/swh/web/tests/api/views/test_vault.py:26:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
api_client = <rest_framework.test.APIClient object at 0x7f0dde98d908>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f0dde98de10>
directory = 'cf78b6273c45c615f3a33201ca67afa4d5d430a9'
revision = '917a9302e28db1e5de630b5cf75516e3fc6ab61d'
@given(directory(), revision())
def test_api_vault_cook(api_client, mocker, directory, revision):
mock_archive = mocker.patch("swh.web.api.views.vault.archive")
for obj_type, obj_id in (
("directory", directory),
("revision_gitfast", revision),
):
fetch_url = reverse(
f"api-1-vault-fetch-{obj_type}", url_args={f"{obj_type[:3]}_id": obj_id},
)
stub_cook = {
"fetch_url": fetch_url,
"type": obj_type,
"progress_msg": None,
"task_id": 1,
"task_status": "done",
"object_id": obj_id,
}
stub_fetch = b"content"
mock_archive.vault_cook.return_value = stub_cook
mock_archive.vault_fetch.return_value = stub_fetch
email = "test@test.mail"
url = reverse(
f"api-1-vault-cook-{obj_type}",
url_args={f"{obj_type[:3]}_id": obj_id},
query_params={"email": email},
)
expected_data = {
"fetch_url": fetch_url,
"obj_type": obj_type,
"progress_message": None,
"id": 1,
"status": "done",
"obj_id": obj_id,
}
rv = check_api_post_responses(api_client, url, data=None, status_code=200)
> assert rv.data == expected_data
E AssertionError: assert {'fetch_url':...k_id': 1, ...} == {'fetch_url':...gitfast', ...}
E Omitting 1 identical items, use -vv to show
E Left contains 5 more items:
E {'object_id': '917a9302e28db1e5de630b5cf75516e3fc6ab61d',
E 'progress_msg': None,
E 'task_id': 1,
E 'task_status': 'done',
E 'type': 'revision_gitfast'}...
E
E ...Full output truncated (23 lines hidden), use '-vv' to show
.tox/py3/lib/python3.7/site-packages/swh/web/tests/api/views/test_vault.py:67: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Nov 19 2020, 3:14 PM