Changeset View
Changeset View
Standalone View
Standalone View
swh/web/tests/vault/test_apiviews.py
- This file was moved from swh/web/tests/api/views/test_vault.py.
Show All 16 Lines | |||||
) | ) | ||||
from swh.web.utils import reverse | from swh.web.utils import reverse | ||||
##################### | ##################### | ||||
# Current API: | # Current API: | ||||
def test_api_vault_cook(api_client, mocker, directory, revision): | def test_api_vault_cook(api_client, mocker, directory, revision): | ||||
mock_archive = mocker.patch("swh.web.api.views.vault.archive") | mock_archive = mocker.patch("swh.web.vault.api_views.archive") | ||||
for bundle_type, swhid, content_type, in ( | for bundle_type, swhid, content_type, in ( | ||||
("flat", f"swh:1:dir:{directory}", "application/gzip"), | ("flat", f"swh:1:dir:{directory}", "application/gzip"), | ||||
("gitfast", f"swh:1:rev:{revision}", "application/gzip"), | ("gitfast", f"swh:1:rev:{revision}", "application/gzip"), | ||||
("git_bare", f"swh:1:rev:{revision}", "application/x-tar"), | ("git_bare", f"swh:1:rev:{revision}", "application/x-tar"), | ||||
): | ): | ||||
swhid = CoreSWHID.from_string(swhid) | swhid = CoreSWHID.from_string(swhid) | ||||
▲ Show 20 Lines • Show All 144 Lines • ▼ Show 20 Lines | else: | ||||
assert re.match(r"Only .* can be cooked as .* bundles\.", rv.data["reason"]) | assert re.match(r"Only .* can be cooked as .* bundles\.", rv.data["reason"]) | ||||
##################### | ##################### | ||||
# Legacy API: | # Legacy API: | ||||
def test_api_vault_cook_legacy(api_client, mocker, directory, revision): | def test_api_vault_cook_legacy(api_client, mocker, directory, revision): | ||||
mock_archive = mocker.patch("swh.web.api.views.vault.archive") | mock_archive = mocker.patch("swh.web.vault.api_views.archive") | ||||
for obj_type, bundle_type, response_obj_type, obj_id in ( | for obj_type, bundle_type, response_obj_type, obj_id in ( | ||||
("directory", "flat", "directory", directory), | ("directory", "flat", "directory", directory), | ||||
("revision_gitfast", "gitfast", "revision", revision), | ("revision_gitfast", "gitfast", "revision", revision), | ||||
): | ): | ||||
swhid = CoreSWHID.from_string(f"swh:1:{obj_type[:3]}:{obj_id}") | swhid = CoreSWHID.from_string(f"swh:1:{obj_type[:3]}:{obj_id}") | ||||
fetch_url = reverse( | fetch_url = reverse( | ||||
▲ Show 20 Lines • Show All 136 Lines • Show Last 20 Lines |