Changeset View
Changeset View
Standalone View
Standalone View
swh/lister/gnu/tests/test_tasks.py
- This file was added.
| from unittest.mock import patch | |||||
| def test_ping(swh_app, celery_session_worker): | |||||
| res = swh_app.send_task( | |||||
| 'swh.lister.gnu.tasks.ping') | |||||
| assert res | |||||
| res.wait() | |||||
| assert res.successful() | |||||
| assert res.result == 'OK' | |||||
| @patch('swh.lister.gnu.tasks.GNULister') | |||||
| def test_lister(lister, swh_app, celery_session_worker): | |||||
| # setup the mocked GNULister | |||||
| lister.return_value = lister | |||||
| lister.run.return_value = None | |||||
| res = swh_app.send_task( | |||||
| 'swh.lister.gnu.tasks.GNUListerTask') | |||||
| assert res | |||||
| res.wait() | |||||
| assert res.successful() | |||||
| lister.assert_called_once_with() | |||||
| lister.db_last_index.assert_not_called() | |||||
| lister.run.assert_called_once_with() | |||||