Changeset View
Changeset View
Standalone View
Standalone View
swh/web/tests/browse/views/test_origin.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 | ||||
import random | import random | ||||
import re | import re | ||||
import swh.web.browse.utils | import swh.web.browse.utils | ||||
▲ Show 20 Lines • Show All 549 Lines • ▼ Show 20 Lines | url = reverse('browse-origin-content', | ||||
url_args=url_args, | url_args=url_args, | ||||
query_params=query_params) | query_params=query_params) | ||||
resp = client.get(url) | resp = client.get(url) | ||||
assert resp.status_code == 200 | assert resp.status_code == 200 | ||||
assert_template_used(resp, 'browse/content.html') | assert_template_used(resp, 'browse/content.html') | ||||
assert type(content['data']) == str | |||||
assert_contains(resp, '<code class="%s">' % | assert_contains(resp, '<code class="%s">' % | ||||
content['hljs_language']) | content['hljs_language']) | ||||
assert_contains(resp, escape(content['data'])) | assert_contains(resp, escape(content['data'])) | ||||
split_path = content_path.split('/') | split_path = content_path.split('/') | ||||
filename = split_path[-1] | filename = split_path[-1] | ||||
path = content_path.replace(filename, '')[:-1] | path = content_path.replace(filename, '')[:-1] | ||||
▲ Show 20 Lines • Show All 328 Lines • Show Last 20 Lines |