Skip to content

Commit bc53526

Browse files
committed
update tests
1 parent 04274f9 commit bc53526

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

tests/tasks/test_harvesting_tasks.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,17 @@ class StartHarvestTestCase(unittest.TestCase):
1010
"""Tests for the start_harvest() task"""
1111

1212
def setUp(self):
13+
self.mock_general_config = mock.patch(
14+
'geospaas_harvesting.config.GeneralConfiguration').start()
1315
self.mock_providers_config = mock.patch(
14-
'geospaas_processing.tasks.harvesting.ProvidersConfiguration').start()
16+
'geospaas_harvesting.config.ProvidersConfiguration').start()
1517
self.mock_search_config = mock.patch(
16-
'geospaas_processing.tasks.harvesting.SearchConfiguration').start()
18+
'geospaas_harvesting.config.SearchConfiguration').start()
1719
self.search_results_mocks = [mock.Mock(), mock.Mock()]
18-
self.mock_search_config.from_dict.return_value \
19-
.with_providers.return_value \
20-
.create_provider_searches.return_value = self.search_results_mocks
20+
(self.mock_search_config.from_dict.return_value
21+
.create_provider_searches.return_value) = self.search_results_mocks
2122
self.mock_celery_group = mock.patch('celery.group').start()
22-
23-
def tearDown(self):
24-
mock.patch.stopall()
23+
self.addCleanup(mock.patch.stopall)
2524

2625
def test_start_harvest(self):
2726
"""Test starting the harvesting process. This doesn't test
@@ -45,7 +44,7 @@ def test_save_search_results(self):
4544
def test_update_vocabularies(self):
4645
"""Test updating vocabularies"""
4746
with mock.patch(
48-
'geospaas_processing.tasks.harvesting.ProvidersConfiguration') as mock_config, \
47+
'geospaas_harvesting.config.GeneralConfiguration') as mock_config, \
4948
mock.patch(
5049
'geospaas_processing.tasks.harvesting.refresh_vocabularies') as mock_refresh:
5150
tasks_harvesting.update_vocabularies()

0 commit comments

Comments
 (0)