Skip to content
Snippets Groups Projects

cgit: Allow url to be optional

Merged Antoine R. Dumont requested to merge ardumont/swh-lister:loosen-mandatory-url into master
1 unresolved thread
Files
3
# Copyright (C) 2019-2022 The Software Heritage developers
# Copyright (C) 2019-2023 The Software Heritage developers
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
@@ -155,6 +155,25 @@ requests_mock_datadir_missing_url = requests_mock_datadir_factory(
)
def test_lister_cgit_instantiate(swh_scheduler):
"""Build a lister with either an url or an instance is fine"""
url = "https://source.codeaurora.org"
lister = CGitLister(swh_scheduler, url=url)
assert lister is not None
assert lister.url == url
assert CGitLister(swh_scheduler, instance="source.codeaurora.org") is not None
assert lister is not None
assert lister.url == url
def test_lister_cgit_fail_to_instantiate(swh_scheduler):
"""Build a lister without its url nor its instance should raise"""
# ... It will raise without any of those
with pytest.raises(ValueError, match="'url' or 'instance'"):
CGitLister(swh_scheduler)
def test_lister_cgit_get_origin_from_repo_failing(
requests_mock_datadir_missing_url, swh_scheduler
):
Loading