diff options
| author | Preston Timmons <prestontimmons@gmail.com> | 2015-08-30 21:13:42 -0500 |
|---|---|---|
| committer | Preston Timmons <prestontimmons@gmail.com> | 2015-08-31 23:03:55 -0500 |
| commit | 4c30fa905d9d47b3a2ee82095b1fe56cc2ec2ab5 (patch) | |
| tree | 2bb04d4ecef539e4ebefbd6d750dfd240ddd7f0c /tests/forms_tests/widget_tests/test_fileinput.py | |
| parent | 5153a3bfdcec82324d67ff79862384288cf6afe6 (diff) | |
Rewrote form widget tests as proper unittests.
This is preparation for landing the template-based widget rendering
patch and goes a long way to making these tests more useful for future
development. The old doctest heritage is strong here.
Diffstat (limited to 'tests/forms_tests/widget_tests/test_fileinput.py')
| -rw-r--r-- | tests/forms_tests/widget_tests/test_fileinput.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/forms_tests/widget_tests/test_fileinput.py b/tests/forms_tests/widget_tests/test_fileinput.py new file mode 100644 index 0000000000..eb1c9d81ed --- /dev/null +++ b/tests/forms_tests/widget_tests/test_fileinput.py @@ -0,0 +1,16 @@ +from django.forms import FileInput + +from .base import WidgetTest + + +class FileInputTest(WidgetTest): + widget = FileInput() + + def test_render(self): + """ + FileInput widgets never render the value attribute. The old value + isn't useful if a form is updated or an error occurred. + """ + self.check_html(self.widget, 'email', 'test@example.com', html='<input type="file" name="email" />') + self.check_html(self.widget, 'email', '', html='<input type="file" name="email" />') + self.check_html(self.widget, 'email', None, html='<input type="file" name="email" />') |
