Changeset View
Changeset View
Standalone View
Standalone View
swh/lister/gitea/tests/test_lister.py
Show First 20 Lines • Show All 132 Lines • ▼ Show 20 Lines | def test_gitea_auth_instance(swh_scheduler, requests_mock, trygitea_p1): | ||||
requests_mock.get(base_url, text=p1_text, headers=p1_headers) | requests_mock.get(base_url, text=p1_text, headers=p1_headers) | ||||
# now check the lister runs without error | # now check the lister runs without error | ||||
stats = lister.run() | stats = lister.run() | ||||
assert stats.pages == 1 | assert stats.pages == 1 | ||||
@pytest.mark.parametrize("http_code", [400, 500, 502]) | @pytest.mark.parametrize("http_code", [400, 500]) | ||||
def test_gitea_list_http_error( | def test_gitea_list_http_error( | ||||
swh_scheduler, requests_mock, http_code, trygitea_p1, trygitea_p2 | swh_scheduler, requests_mock, http_code, trygitea_p1, trygitea_p2 | ||||
): | ): | ||||
"""Test handling of some HTTP errors commonly encountered""" | """Test handling of some HTTP errors commonly encountered""" | ||||
lister = GiteaLister(scheduler=swh_scheduler, url=TRYGITEA_URL, page_size=3) | lister = GiteaLister(scheduler=swh_scheduler, url=TRYGITEA_URL, page_size=3) | ||||
p1_text, p1_headers, _, p1_origin_urls = trygitea_p1 | p1_text, p1_headers, _, p1_origin_urls = trygitea_p1 | ||||
Show All 27 Lines |