From 55c3133df86447129d5c912102f3c4f7b56092c6 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Sat, 14 May 2016 10:31:32 -0400 Subject: [PATCH] Simplified a ClearableFileInput test. --- .../widget_tests/test_clearablefileinput.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/tests/forms_tests/widget_tests/test_clearablefileinput.py b/tests/forms_tests/widget_tests/test_clearablefileinput.py index 5c093dbd46..46bad58f3a 100644 --- a/tests/forms_tests/widget_tests/test_clearablefileinput.py +++ b/tests/forms_tests/widget_tests/test_clearablefileinput.py @@ -1,6 +1,5 @@ from django.core.files.uploadedfile import SimpleUploadedFile from django.forms import ClearableFileInput -from django.utils import six from django.utils.encoding import python_2_unicode_compatible from .base import WidgetTest @@ -47,15 +46,15 @@ class ClearableFileInputTest(WidgetTest): def __str__(self): return '''something
.jpg''' - widget = ClearableFileInput() - field = StrangeFieldFile() - output = widget.render('my
file', field) - self.assertNotIn(field.url, output) - self.assertIn('href="something?chapter=1&sect=2&copy=3&lang=en"', output) - self.assertNotIn(six.text_type(field), output) - self.assertIn('something<div onclick="alert('oops')">.jpg', output) - self.assertIn('my<div>file', output) - self.assertNotIn('my
file', output) + self.check_html(ClearableFileInput(), 'my
file', StrangeFieldFile(), html=( + """ + Currently: + something<div onclick="alert('oops')">.jpg + +
+ Change: + """ + )) def test_clear_input_renders_only_if_not_required(self): """