test_tasks: Align test consistently with other using mocker

This commit is contained in:
Antoine R. Dumont (@ardumont) 2021-07-09 10:12:38 +02:00
parent fe01d08cd9
commit 698be475e9
No known key found for this signature in database
GPG key ID: 52E2E9840D10C3B8

View file

@ -1,10 +1,8 @@
# Copyright (C) 2019-2020 The Software Heritage developers
# Copyright (C) 2019-2021 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
from unittest.mock import patch
from swh.lister.pattern import ListerStats
@ -16,9 +14,10 @@ def test_ping(swh_scheduler_celery_app, swh_scheduler_celery_worker):
assert res.result == "OK"
@patch("swh.lister.pypi.tasks.PyPILister")
def test_lister(lister, swh_scheduler_celery_app, swh_scheduler_celery_worker):
# setup the mocked PypiLister
def test_pypi_full_lister(
swh_scheduler_celery_app, swh_scheduler_celery_worker, mocker
):
lister = mocker.patch("swh.lister.pypi.tasks.PyPILister")
lister.from_configfile.return_value = lister
lister.run.return_value = ListerStats(pages=1, origins=0)