Changeset View
Changeset View
Standalone View
Standalone View
swh/web/save_origin_webhooks/tests/utils.py
Show First 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | ): | ||||
) | ) | ||||
assert resp.data == { | assert resp.data == { | ||||
"exception": "BadInputExc", | "exception": "BadInputExc", | ||||
"reason": ( | "reason": ( | ||||
f"Repository URL could not be extracted from {forge_type} webhook payload." | f"Repository URL could not be extracted from {forge_type} webhook payload." | ||||
), | ), | ||||
} | } | ||||
def origin_save_webhook_receiver_private_repo_test( | |||||
forge_type: str, | |||||
http_headers: Dict[str, Any], | |||||
payload: Dict[str, Any], | |||||
api_client, | |||||
expected_origin_url: str, | |||||
): | |||||
url = reverse(f"api-1-origin-save-webhook-{forge_type.lower()}") | |||||
resp = check_api_post_responses( | |||||
api_client, | |||||
url, | |||||
status_code=400, | |||||
data=payload, | |||||
**django_http_headers(http_headers), | |||||
) | |||||
assert resp.data == { | |||||
"exception": "BadInputExc", | |||||
"reason": ( | |||||
f"Repository {expected_origin_url} is private and cannot be cloned " | |||||
"without authentication." | |||||
), | |||||
} |