lister.github.tests: Clarify lister configuration

This commit is contained in:
Antoine R. Dumont (@ardumont) 2020-10-29 17:43:22 +01:00
parent def0eb5060
commit 978fbbe029
No known key found for this signature in database
GPG key ID: 52E2E9840D10C3B8
2 changed files with 29 additions and 9 deletions

View file

@ -0,0 +1,26 @@
# Copyright (C) 2019-2020 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
@pytest.fixture
def lister_under_test():
return "github"
@pytest.fixture
def lister_github(swh_lister):
for task_type in [
{
"type": "load-git",
"description": "Load git repository",
"backend_name": "swh.loader.git.tasks.UpdateGitRepository",
"default_interval": "1 day",
},
]:
swh_lister.scheduler.create_task_type(task_type)
return swh_lister

View file

@ -6,7 +6,6 @@
import re
import unittest
import pytest
import requests_mock
from swh.lister.core.tests.test_lister import HttpListerTester
@ -58,18 +57,13 @@ class GitHubListerTester(HttpListerTester, unittest.TestCase):
)
@pytest.fixture
def lister_under_test():
return "github"
def test_lister_github(swh_lister, requests_mock_datadir):
def test_lister_github(lister_github, requests_mock_datadir):
"""Simple github listing should create scheduled tasks
"""
swh_lister.run()
lister_github.run()
r = swh_lister.scheduler.search_tasks(task_type="load-git")
r = lister_github.scheduler.search_tasks(task_type="load-git")
assert len(r) == 100
for row in r: