Changeset View
Changeset View
Standalone View
Standalone View
swh/web/tests/browse/views/test_content.py
# Copyright (C) 2017-2019 The Software Heritage developers | # Copyright (C) 2017-2020 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU Affero General Public License version 3, or any later version | # License: GNU Affero General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
from django.utils.html import escape | from django.utils.html import escape | ||||
from hypothesis import given | from hypothesis import given | ||||
▲ Show 20 Lines • Show All 363 Lines • ▼ Show 20 Lines | def _process_content_for_display(archive_data, content): | ||||
content_data = archive_data.content_get(content['sha1']) | content_data = archive_data.content_get(content['sha1']) | ||||
mime_type, encoding = get_mimetype_and_encoding_for_content( | mime_type, encoding = get_mimetype_and_encoding_for_content( | ||||
content_data['data']) | content_data['data']) | ||||
mime_type, encoding, content_data = _re_encode_content( | mime_type, encoding, content_data = _re_encode_content( | ||||
mime_type, encoding, content_data['data']) | mime_type, encoding, content_data['data']) | ||||
return prepare_content_for_display(content_data, mime_type, | content_display = prepare_content_for_display(content_data, mime_type, | ||||
content['path']) | content['path']) | ||||
assert type(content_display['content_data']) == str | |||||
return content_display |