Skip to content
This repository was archived by the owner on Sep 18, 2022. It is now read-only.
This repository was 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

Description

@calvinchengx
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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions