lister.bitbucket.tests: Clarify lister configuration
This commit is contained in:
parent
f09b9f8cfa
commit
c5af0efbf4
2 changed files with 36 additions and 12 deletions
32
swh/lister/bitbucket/tests/conftest.py
Normal file
32
swh/lister/bitbucket/tests/conftest.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
# 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 "bitbucket"
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def lister_bitbucket(swh_lister):
|
||||
for task_type in [
|
||||
{
|
||||
"type": "load-git",
|
||||
"description": "Load git repository",
|
||||
"backend_name": "swh.loader.git.tasks.UpdateGitRepository",
|
||||
"default_interval": "1 day",
|
||||
},
|
||||
{
|
||||
"type": "load-hg",
|
||||
"description": "Load hg repository",
|
||||
"backend_name": "swh.loader.mercurial.tasks.LoadMercurial",
|
||||
"default_interval": "1 day",
|
||||
},
|
||||
]:
|
||||
swh_lister.scheduler.create_task_type(task_type)
|
||||
|
||||
return swh_lister
|
|
@ -9,18 +9,12 @@ import unittest
|
|||
from urllib.parse import unquote
|
||||
|
||||
import iso8601
|
||||
import pytest
|
||||
import requests_mock
|
||||
|
||||
from swh.lister.bitbucket.lister import BitBucketLister
|
||||
from swh.lister.core.tests.test_lister import HttpListerTester
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def lister_under_test():
|
||||
return "bitbucket"
|
||||
|
||||
|
||||
def _convert_type(req_index):
|
||||
"""Convert the req_index to its right type according to the model's
|
||||
"indexable" column.
|
||||
|
@ -85,15 +79,13 @@ class BitBucketListerTester(HttpListerTester, unittest.TestCase):
|
|||
)
|
||||
|
||||
|
||||
def test_lister_bitbucket(swh_lister, requests_mock_datadir):
|
||||
def test_lister_bitbucket(lister_bitbucket, requests_mock_datadir):
|
||||
"""Simple bitbucket listing should create scheduled tasks (git, hg)
|
||||
|
||||
"""
|
||||
lister = swh_lister
|
||||
lister_bitbucket.run()
|
||||
|
||||
lister.run()
|
||||
|
||||
r = lister.scheduler.search_tasks(task_type="load-hg")
|
||||
r = lister_bitbucket.scheduler.search_tasks(task_type="load-hg")
|
||||
assert len(r) == 9
|
||||
|
||||
for row in r:
|
||||
|
@ -109,7 +101,7 @@ def test_lister_bitbucket(swh_lister, requests_mock_datadir):
|
|||
assert row["policy"] == "recurring"
|
||||
assert row["priority"] is None
|
||||
|
||||
r = lister.scheduler.search_tasks(task_type="load-git")
|
||||
r = lister_bitbucket.scheduler.search_tasks(task_type="load-git")
|
||||
assert len(r) == 1
|
||||
|
||||
for row in r:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue