Changeset View
Changeset View
Standalone View
Standalone View
swh/lister/tests/test_cli.py
Show All 33 Lines | def test_get_lister(swh_scheduler_config): | ||||
for lister_name in SUPPORTED_LISTERS: | for lister_name in SUPPORTED_LISTERS: | ||||
lst = get_lister( | lst = get_lister( | ||||
lister_name, | lister_name, | ||||
db_url, | db_url, | ||||
scheduler={"cls": "local", **swh_scheduler_config}, | scheduler={"cls": "local", **swh_scheduler_config}, | ||||
**lister_args.get(lister_name, {}), | **lister_args.get(lister_name, {}), | ||||
) | ) | ||||
assert hasattr(lst, "run") | assert hasattr(lst, "run") | ||||
def test_get_lister_override(): | |||||
"""Overriding the lister configuration should populate its config | |||||
""" | |||||
db_url = init_db().url() | |||||
listers = { | |||||
"cgit": "https://some.where/cgit", | |||||
} | |||||
# check the override ends up defined in the lister | |||||
for lister_name, url in listers.items(): | |||||
lst = get_lister( | |||||
lister_name, db_url, url=url, priority="high", policy="oneshot" | |||||
) | |||||
assert lst.url == url | |||||
assert lst.config["priority"] == "high" | |||||
assert lst.config["policy"] == "oneshot" | |||||
# check the default urls are used and not the override (since it's not | |||||
# passed) | |||||
for lister_name, url in listers.items(): | |||||
lst = get_lister(lister_name, db_url) | |||||
# no override so this does not end up in lister's configuration | |||||
assert "url" not in lst.config | |||||
assert "priority" not in lst.config | |||||
assert "oneshot" not in lst.config | |||||
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.