diff --git a/swh/lister/phabricator/tasks.py b/swh/lister/phabricator/tasks.py index ce37fa4..5ec794d 100644 --- a/swh/lister/phabricator/tasks.py +++ b/swh/lister/phabricator/tasks.py @@ -1,29 +1,23 @@ # Copyright (C) 2019 the Software Heritage developers # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information from swh.scheduler.celery_backend.config import app from swh.lister.phabricator.lister import PhabricatorLister def new_lister(forge_url='https://forge.softwareheritage.org', instance='swh', api_token=None, **kw): return PhabricatorLister( forge_url=forge_url, instance=instance, api_token=api_token, **kw) -@app.task(name=__name__ + '.IncrementalPhabricatorLister') -def incremental_phabricator_lister(**lister_args): - lister = new_lister(**lister_args) - lister.run(min_bound=lister.db_last_index()) - - @app.task(name=__name__ + '.FullPhabricatorLister') def full_phabricator_lister(**lister_args): lister = new_lister(**lister_args) lister.run() @app.task(name=__name__ + '.ping') def ping(): return 'OK' diff --git a/swh/lister/phabricator/tests/test_tasks.py b/swh/lister/phabricator/tests/test_tasks.py index 0aa27d6..7651c7d 100644 --- a/swh/lister/phabricator/tests/test_tasks.py +++ b/swh/lister/phabricator/tests/test_tasks.py @@ -1,30 +1,8 @@ -from unittest.mock import patch - def test_ping(swh_app, celery_session_worker): res = swh_app.send_task( 'swh.lister.phabricator.tasks.ping') assert res res.wait() assert res.successful() assert res.result == 'OK' - - -@patch('swh.lister.phabricator.tasks.PhabricatorLister') -def test_incremental(lister, swh_app, celery_session_worker): - # setup the mocked PhabricatorLister - lister.return_value = lister - lister.db_last_index.return_value = 42 - lister.run.return_value = None - - res = swh_app.send_task( - 'swh.lister.phabricator.tasks.IncrementalPhabricatorLister') - assert res - res.wait() - assert res.successful() - - lister.assert_called_once_with( - api_token=None, forge_url='https://forge.softwareheritage.org', - instance='swh') - lister.db_last_index.assert_called_once_with() - lister.run.assert_called_once_with(min_bound=42)