Changeset View
Changeset View
Standalone View
Standalone View
swh/lister/tuleap/tests/test_lister.py
# Copyright (C) 2021 The Software Heritage developers | # Copyright (C) 2021-2022 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 General Public License version 3, or any later version | # License: GNU 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 json | import json | ||||
from pathlib import Path | from pathlib import Path | ||||
from typing import Dict, List, Tuple | from typing import Dict, List, Tuple | ||||
▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | for r in reps["repositories"]: | ||||
TuleapLister.results_simplified(url=TULEAP_URL, repo_type="git", repo=r) | TuleapLister.results_simplified(url=TULEAP_URL, repo_type="git", repo=r) | ||||
) | ) | ||||
origin_urls = [r["uri"] for r in page_results] | origin_urls = [r["uri"] for r in page_results] | ||||
return text, headers, page_results, origin_urls | return text, headers, page_results, origin_urls | ||||
@pytest.fixture(autouse=True) | @pytest.fixture(autouse=True) | ||||
def retry_sleep_mock(mocker): | def retry_sleep_mock(mocker): | ||||
mocker.patch.object(TuleapLister.page_request.retry, "sleep") | mocker.patch.object(TuleapLister.http_request.retry, "sleep") | ||||
def check_listed_origins(lister_urls: List[str], scheduler_origins: List[ListedOrigin]): | def check_listed_origins(lister_urls: List[str], scheduler_origins: List[ListedOrigin]): | ||||
"""Asserts that the two collections have the same origin URLs. | """Asserts that the two collections have the same origin URLs. | ||||
Does not test last_update.""" | Does not test last_update.""" | ||||
assert set(lister_urls) == {origin.url for origin in scheduler_origins} | assert set(lister_urls) == {origin.url for origin in scheduler_origins} | ||||
▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines |