Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/nixguix/tests/test_tasks.py
# Copyright (C) 2020 The Software Heritage developers | # Copyright (C) 2020 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
def test_nixguix_loader(mocker, swh_app, celery_session_worker, swh_config): | def test_nixguix_loader(mocker, swh_app, celery_session_worker, swh_config): | ||||
mock_loader = mocker.patch( | mock_loader = mocker.patch( | ||||
'swh.loader.package.nixguix.loader.NixGuixLoader.load') | 'swh.loader.package.nixguix.loader.NixGuixLoader.load') | ||||
mock_loader.return_value = {'status': 'eventful'} | mock_loader.return_value = {'status': 'eventful'} | ||||
mock_retrieve_sources = mocker.patch( | mock_retrieve_sources = mocker.patch( | ||||
'swh.loader.package.nixguix.loader.retrieve_sources') | 'swh.loader.package.nixguix.loader.retrieve_sources') | ||||
mock_retrieve_sources.return_value = { | mock_retrieve_sources.return_value = { | ||||
'sources': [], | 'sources': [], | ||||
'byIntegrity': {}, | |||||
'revision': 'some-revision' | 'revision': 'some-revision' | ||||
} | } | ||||
res = swh_app.send_task( | res = swh_app.send_task( | ||||
'swh.loader.package.nixguix.tasks.LoadNixguix', | 'swh.loader.package.nixguix.tasks.LoadNixguix', | ||||
kwargs=dict(url='some-url')) | kwargs=dict(url='some-url')) | ||||
assert res | assert res | ||||
res.wait() | res.wait() | ||||
assert res.successful() | assert res.successful() | ||||
assert res.result == {'status': 'eventful'} | assert res.result == {'status': 'eventful'} |