Changeset View
Changeset View
Standalone View
Standalone View
swh/web/tests/browse/views/test_revision.py
# Copyright (C) 2017-2020 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 textwrap | import textwrap | ||||
from django.utils.html import escape | from django.utils.html import escape | ||||
from hypothesis import given | from hypothesis import given | ||||
from swh.model.identifiers import DIRECTORY, REVISION, SNAPSHOT | from swh.model.identifiers import DIRECTORY, REVISION, SNAPSHOT | ||||
from swh.web.common.identifiers import get_swh_persistent_id | from swh.web.common.identifiers import get_swh_persistent_id | ||||
from swh.web.common.utils import reverse, format_utc_iso_date, parse_timestamp | from swh.web.common.utils import reverse, format_utc_iso_date, parse_timestamp | ||||
Show All 12 Lines | def test_revision_origin_snapshot_browse(client, archive_data, origin): | ||||
revision = archive_data.snapshot_get_head(snapshot) | revision = archive_data.snapshot_get_head(snapshot) | ||||
_revision_browse_checks(client, archive_data, revision, origin_url=origin["url"]) | _revision_browse_checks(client, archive_data, revision, origin_url=origin["url"]) | ||||
_revision_browse_checks(client, archive_data, revision, snapshot=snapshot) | _revision_browse_checks(client, archive_data, revision, snapshot=snapshot) | ||||
_revision_browse_checks( | _revision_browse_checks( | ||||
client, archive_data, revision, origin_url=origin["url"], snapshot=snapshot, | client, archive_data, revision, origin_url=origin["url"], snapshot=snapshot, | ||||
) | ) | ||||
revision = random.choice(archive_data.revision_log(revision))["id"] | |||||
_revision_browse_checks(client, archive_data, revision, origin_url=origin["url"]) | |||||
@given(revision()) | @given(revision()) | ||||
def test_revision_log_browse(client, archive_data, revision): | def test_revision_log_browse(client, archive_data, revision): | ||||
per_page = 10 | per_page = 10 | ||||
revision_log = archive_data.revision_log(revision) | revision_log = archive_data.revision_log(revision) | ||||
revision_log_sorted = sorted( | revision_log_sorted = sorted( | ||||
▲ Show 20 Lines • Show All 290 Lines • Show Last 20 Lines |