client = <django.test.client.Client object at 0x7f9253ebd0f0>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f9253a1fcc0>
origin = {'archives': ['libtess2.zip'], 'id': b'\x0fH`\x80Q\x0eN\xeb\x98\xbe\x0c\xc8k\xa8\x06\xc0\xc7>\xe8\xa2', 'metadata': {'...ma/codemeta-2.0', 'description': 'Game and tools oriented refactored version of GLU tessellator.'}, 'type': 'git', ...}
def test_browse_origin_content_no_visit(client, mocker, origin):
mock_get_origin_visits = mocker.patch(
"swh.web.common.origin_visits.get_origin_visits"
)
mock_get_origin_visits.return_value = []
mock_archive = mocker.patch("swh.web.common.origin_visits.archive")
mock_archive.lookup_origin_visit_latest.return_value = None
url = reverse(
"browse-origin-content",
query_params={"origin_url": origin["url"], "path": "foo"},
)
resp = check_html_get_response(
> client, url, status_code=404, template_used="error.html"
)
.tox/py3/lib/python3.7/site-packages/swh/web/tests/browse/views/test_origin.py:545:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/web/tests/utils.py:207: in check_html_get_response
client, url, status_code, content_type="text/html"
.tox/py3/lib/python3.7/site-packages/swh/web/tests/utils.py:68: in check_http_get_response
content_type=content_type,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
response = <HttpResponsePermanentRedirect status_code=301, "text/html; charset=utf-8", url="/browse/content/?origin_url=https://github.com/memononen/libtess2&path=foo">
status_code = 404, content_type = 'text/html'
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: b''
E assert 301 == 404
E +301
E -404
.tox/py3/lib/python3.7/site-packages/swh/web/tests/utils.py:34: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Nov 5 2021, 1:47 PM