Changeset View
Changeset View
Standalone View
Standalone View
swh/lister/tests/test_cli.py
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
def test_get_lister_override(): | def test_get_lister_override(): | ||||
"""Overriding the lister configuration should populate its config | """Overriding the lister configuration should populate its config | ||||
""" | """ | ||||
db_url = init_db().url() | db_url = init_db().url() | ||||
listers = { | listers = { | ||||
"gitlab": "https://other.gitlab.uni/api/v4/", | "gitlab": "https://other.gitlab.uni/api/v4/", | ||||
"cgit": "https://some.where/cgit", | |||||
} | } | ||||
# check the override ends up defined in the lister | # check the override ends up defined in the lister | ||||
for lister_name, url in listers.items(): | for lister_name, url in listers.items(): | ||||
lst = get_lister( | lst = get_lister( | ||||
lister_name, db_url, url=url, priority="high", policy="oneshot" | lister_name, db_url, url=url, priority="high", policy="oneshot" | ||||
) | ) | ||||
assert lst.url == url | assert lst.url == url | ||||
assert lst.config["priority"] == "high" | assert lst.config["priority"] == "high" | ||||
assert lst.config["policy"] == "oneshot" | assert lst.config["policy"] == "oneshot" | ||||
# check the default urls are used and not the override (since it's not | # check the default urls are used and not the override (since it's not | ||||
# passed) | # passed) | ||||
for lister_name, url in listers.items(): | for lister_name, url in listers.items(): | ||||
lst = get_lister(lister_name, db_url) | lst = get_lister(lister_name, db_url) | ||||
# no override so this does not end up in lister's configuration | # no override so this does not end up in lister's configuration | ||||
assert "url" not in lst.config | assert "url" not in lst.config | ||||
assert "priority" not in lst.config | assert "priority" not in lst.config | ||||
assert "oneshot" not in lst.config | assert "oneshot" not in lst.config | ||||
assert lst.url == lst.DEFAULT_URL | assert lst.url == lst.DEFAULT_URL | ||||
ardumont: For those wondering, this test is no longer relevant as those listers are no longer exposing… |
For those wondering, this test is no longer relevant as those listers are no longer exposing the conf_override parameter in their constructor.