lister.tests: Add missing task_type for package listers
The scheduler module no longer initializes itself those task_type.
This commit is contained in:
parent
5191d291da
commit
1cf7c8e86b
10 changed files with 104 additions and 22 deletions
|
@ -1 +1,23 @@
|
|||
# Copyright (C) 2019 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
|
||||
|
||||
import pytest
|
||||
|
||||
from swh.lister.core.tests.conftest import * # noqa
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def lister_npm(swh_listers):
|
||||
lister = swh_listers['npm']
|
||||
|
||||
# Add the load-deb-package in the scheduler backend
|
||||
lister.scheduler.create_task_type({
|
||||
'type': 'load-npm',
|
||||
'description': 'Load npm package',
|
||||
'backend_name': 'swh.loader.package.tasks.LoadNpm',
|
||||
'default_interval': '1 day',
|
||||
})
|
||||
|
||||
return lister
|
||||
|
|
|
@ -77,19 +77,17 @@ def check_tasks(tasks: List[Any]):
|
|||
assert row['priority'] is None
|
||||
|
||||
|
||||
def test_lister_npm_basic_listing(swh_listers, requests_mock_datadir):
|
||||
lister = swh_listers['npm']
|
||||
def test_lister_npm_basic_listing(lister_npm, requests_mock_datadir):
|
||||
lister_npm.run()
|
||||
|
||||
lister.run()
|
||||
|
||||
tasks = lister.scheduler.search_tasks(task_type='load-npm')
|
||||
tasks = lister_npm.scheduler.search_tasks(task_type='load-npm')
|
||||
assert len(tasks) == 100
|
||||
|
||||
check_tasks(tasks)
|
||||
|
||||
|
||||
def test_lister_npm_listing_pagination(swh_listers, requests_mock_datadir):
|
||||
lister = swh_listers['npm']
|
||||
def test_lister_npm_listing_pagination(lister_npm, requests_mock_datadir):
|
||||
lister = lister_npm
|
||||
# Patch per page pagination
|
||||
lister.per_page = 10 + 1
|
||||
lister.PATH_TEMPLATE = lister.PATH_TEMPLATE.replace(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue