mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
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.
This commit is contained in:
16
tests/forms_tests/widget_tests/test_fileinput.py
Normal file
16
tests/forms_tests/widget_tests/test_fileinput.py
Normal file
@@ -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" />')
|
||||
Reference in New Issue
Block a user