api_client = <rest_framework.test.APIClient object at 0x7f45de84cb70>
directory = '04046f0d4da224462a9eff42b42dbf91d56c99cc'
revision = 'd7c52cd81010768c4a51b6ad468fc95cb84e2858'
def test_api_vault_cook_uppercase_hash_legacy(api_client, directory, revision):
for obj_type, obj_id in (
("directory", directory),
("revision_gitfast", revision),
):
url = reverse(
f"api-1-vault-cook-{obj_type}-uppercase-checksum",
url_args={f"{obj_type[:3]}_id": obj_id.upper()},
)
rv = check_http_post_response(
> api_client, url, data={"email": "test@test.mail"}, status_code=302
)
.tox/py3/lib/python3.7/site-packages/swh/web/tests/api/views/test_vault.py:249:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
client = <rest_framework.test.APIClient object at 0x7f45de84cb70>
url = '/api/1/vault/directory/04046F0D4DA224462A9EFF42B42DBF91D56C99CC/'
status_code = 302, content_type = '*/*'
request_content_type = 'application/json', data = {'email': 'test@test.mail'}
http_origin = None
def check_http_post_response(
client: Client,
url: str,
status_code: int,
content_type: str = "*/*",
request_content_type="application/json",
data: Optional[Dict[str, Any]] = None,
http_origin: Optional[str] = None,
) -> HttpResponse:
"""Helper function to check HTTP response for a POST request.
Args:
client: Django test client
url: URL to check response
status_code: expected HTTP status code
content_type: expected response content type
request_content_type: content type of request body
data: optional POST data
Returns:
The HTTP response
"""
actual_response = client.post(
url,
data=data,
content_type=request_content_type,
HTTP_ACCEPT=content_type,
HTTP_ORIGIN=http_origin,
)
> assert isinstance(actual_response, Response)
E assert False
E + where False = isinstance(<HttpResponseRedirect status_code=302, "text/html; charset=utf-8", url="/api/1/vault/directory/04046f0d4da224462a9eff42b42dbf91d56c99cc/">, Response)
.tox/py3/lib/python3.7/site-packages/swh/web/tests/utils.py:103: AssertionError
TEST RESULT
TEST RESULT
- Run At
- May 25 2022, 4:46 PM