Skip to content
This repository has been archived by the owner on Sep 18, 2022. It is now read-only.

test_uni_form_invalid_helper does not kick up a TemplateSyntaxError #121

Open
calvinchengx opened this issue Nov 19, 2011 · 0 comments
Open

Comments

@calvinchengx
Copy link

def test_uni_form_invalid_helper(self):
    template = get_template_from_string(u"""
        {% load uni_form_tags %}
        {% uni_form form form_helper %}
    """)
    c = Context({'form': TestForm(), 'form_helper': "invalid"})

    settings.UNIFORM_FAIL_SILENTLY = False
    if settings.TEMPLATE_DEBUG:
        self.assertRaises(TemplateSyntaxError, lambda:template.render(c))
    else:
        self.assertRaises(TypeError, lambda:template.render(c))
    del settings.UNIFORM_FAIL_SILENTLY

This unit test should kick up a template syntax error when settings.TEMPLATE_DEBUG is true.

However, I am still seeing TypeError instead of a TemplateSyntaxError.

Reference traceback as follows:

./manage.py test uni_form
Creating test database for alias 'default'...

..........E...........

ERROR: test_uni_form_invalid_helper (uni_form.tests.tests.TestFormHelpers)

Traceback (most recent call last):
File "/Users/calvin/.virtualenvs/booking/src/django-uni-form/uni_form/tests/tests.py", line 218, in test_uni_form_invalid_helper
print 2, template.render(c)
File "/Users/calvin/.virtualenvs/booking/src/django/django/template/base.py", line 139, in render
return self._render(context)
File "/Users/calvin/.virtualenvs/booking/src/django/django/test/utils.py", line 62, in instrumented_test_render
return self.nodelist.render(context)
File "/Users/calvin/.virtualenvs/booking/src/django/django/template/base.py", line 823, in render
bit = self.render_node(node, context)
File "/Users/calvin/.virtualenvs/booking/src/django/django/template/debug.py", line 73, in render_node
return node.render(context)
File "/Users/calvin/.virtualenvs/booking/src/django-uni-form/uni_form/templatetags/uni_form_tags.py", line 147, in render
c = self.get_render(context)
File "/Users/calvin/.virtualenvs/booking/src/django-uni-form/uni_form/templatetags/uni_form_tags.py", line 83, in get_render
raise TypeError('helper object provided to uni_form tag must be a uni_form.helpers.FormHelper object.')
TypeError: helper object provided to uni_form tag must be a uni_form.helpers.FormHelper object.


Ran 22 tests in 0.257s

FAILED (errors=1)

Am I missing something here or is this unit test not updated yet?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant