Skip to content

Commit

Permalink
Fix test render to string
Browse files Browse the repository at this point in the history
  • Loading branch information
LePetitTim committed Aug 8, 2022
1 parent cf13b44 commit ce6985e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions geotrek/common/tests/test_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,24 +503,25 @@ def test_geotrek_aggregator_parser_model_dynamic_segmentation(self):

@skipIf(settings.TREKKING_TOPOLOGY_ENABLED, 'Test without dynamic segmentation only')
@mock.patch('geotrek.common.parsers.importlib.import_module', return_value=mock.MagicMock())
@mock.patch('django.template.loader.render_to_string')
@mock.patch('requests.get')
def test_geotrek_aggregator_parser(self, mocked_get, mocked_import_module):
def test_geotrek_aggregator_parser(self, mocked_get, mocked_render, mocked_import_module):
def mocked_json():
return {}

def side_effect_render(file, context):
return ''

mocked_get.json = mocked_json
mocked_get.return_value.status_code = 200
mocked_get.return_value.content = b''
mocked_render.side_effect = side_effect_render
output = StringIO()
filename = os.path.join(os.path.dirname(__file__), 'data', 'geotrek_parser_v2', 'config_aggregator.json')
call_command('import', 'geotrek.common.parsers.GeotrekAggregatorParser', filename=filename, verbosity=2,
stdout=output)
string_parser = output.getvalue()

self.assertIn('URL_1 :', string_parser)
self.assertIn('URL_2 :', string_parser)
self.assertIn('URL_3 :', string_parser)

# "VTT", "Vélo"
# "Trek", "Service", "POI"
# "POI", "InformationDesk", "TouristicContent"
Expand Down

0 comments on commit ce6985e

Please sign in to comment.