diff --git a/combo/utils/urls.py b/combo/utils/urls.py index b0c17c43..10703e9f 100644 --- a/combo/utils/urls.py +++ b/combo/utils/urls.py @@ -55,7 +55,7 @@ def get_templated_url(url, context=None): except VariableDoesNotExist as e: raise TemplateError(e.msg, e.params) except TemplateSyntaxError: - return 'TEMPLATE ERROR' + raise TemplateError('syntax error') # ezt-like template def repl(matchobj): varname = matchobj.group(0)[1:-1] diff --git a/tests/test_pages.py b/tests/test_pages.py index 2adfbdb7..b8f40a9f 100644 --- a/tests/test_pages.py +++ b/tests/test_pages.py @@ -296,13 +296,3 @@ def test_render(app): response = app.get(page.get_online_url()) assert '' in response.text assert 'Combo - foo' in response.text - -def test_render_cell_having_href_template_error(app): - page = Page(title=u'foo', slug='foo', template_name='standard-sidebar', order=0, description="page description") - page.save() - cell = TextCell(page=page, - text='link', - order=0, placeholder='content') - cell.save() - response = app.get(page.get_online_url()) - assert 'link' in response.text diff --git a/tests/test_utils.py b/tests/test_utils.py index 93836700..422b9a88 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -131,7 +131,8 @@ def test_templated_url(): assert get_templated_url('{{ foo.0.bar }}{{ foo.0.zoo }}', context={'foo': [{'bar': 'ok'}, 'ko']}) == 'ok' # catch django syntax errors in TemplateError for template in ('{% foobar %}', '{% if "coucou" %}', '{{}}', '{{ if "x" }}', '{{ _private }}'): - assert get_templated_url(template, context=ctx) == 'TEMPLATE ERROR' + with pytest.raises(TemplateError, match='syntax error'): + assert get_templated_url(template, context=ctx) == 'bar' # requestcontext with override_settings(TEMPLATE_VARS={'test_url': 'http://www.example.net'}):