api_client = <rest_framework.test.APIClient object at 0x7f5737334dd8>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f57364c7550>
def test_save_request_rejected(api_client, mocker):
origin_url = "https://github.com/user/illegal_repo"
check_created_save_request_status(
> api_client, mocker, origin_url, expected_request_status=SAVE_REQUEST_REJECTED,
)
.tox/py3/lib/python3.7/site-packages/swh/web/tests/api/views/test_origin_save.py:200:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/web/tests/api/views/test_origin_save.py:131: in check_created_save_request_status
check_api_post_responses(api_client, url, data=None, status_code=403)
.tox/py3/lib/python3.7/site-packages/swh/web/tests/utils.py:179: in check_api_post_responses
api_client, url, status_code, content_type="application/json", data=data
.tox/py3/lib/python3.7/site-packages/swh/web/tests/utils.py:156: in check_api_post_response
content_type=content_type,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
response = <Response status_code=400, "application/json">, status_code = 403
content_type = 'application/json'
def _assert_http_response(
response: HttpResponse, status_code: int, content_type: str
) -> HttpResponse:
if isinstance(response, Response):
drf_response = cast(Response, response)
error_context = (
drf_response.data.pop("traceback")
if isinstance(drf_response.data, dict) and "traceback" in drf_response.data
else drf_response.data
)
elif isinstance(response, StreamingHttpResponse):
error_context = getattr(response, "traceback", response.streaming_content)
else:
error_context = getattr(response, "traceback", response.content)
> assert response.status_code == status_code, error_context
E AssertionError: Traceback (most recent call last):
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/rest_framework/views.py", line 506, in dispatch
E response = handler(request, *args, **kwargs)
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/rest_framework/decorators.py", line 50, in handler
E return func(*args, **kwargs)
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/web/api/apiurls.py", line 96, in api_view_f
E response = f(request, **kwargs)
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/web/api/apidoc.py", line 348, in documented_view
E raise exc
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/web/api/apidoc.py", line 345, in documented_view
E return {"data": f(request, **kwargs), "doc_data": doc_data}
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/web/api/views/origin_save.py", line 86, in api_save_origin
E sor = create_save_origin_request(visit_type, origin_url)
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/web/common/origin_save.py", line 375, in create_save_origin_request
E _check_origin_exists(origin_url)
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/web/common/origin_save.py", line 190, in _check_origin_exists
E f"The provided origin url ({escape(origin_url)}) does not exist!"
E swh.web.common.exc.BadInputExc: The provided origin url (https://github.com/user/illegal_repo) does not exist!
E
E assert 400 == 403
E +400
E -403
.tox/py3/lib/python3.7/site-packages/swh/web/tests/utils.py:32: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Apr 30 2021, 12:44 PM