@@ -52,14 +52,6 @@ def setUp(self):
52
52
self .factory = RequestFactory ()
53
53
super (BaseTestCase , self ).setUp ()
54
54
55
- def assertFormError (self , response , form , field , errors , msg_prefix = "" ):
56
- # Hack to get around the fact that we're using request factory,
57
- # instead of the full test client.
58
- response .context = response .context_data
59
- return super (BaseTestCase , self ).assertFormError (
60
- response , form , field , errors , msg_prefix
61
- )
62
-
63
55
def assertContext (self , response , expected ):
64
56
# Ensure the keys all match.
65
57
# Note that this style ensures we get nice descriptive failures.
@@ -301,8 +293,7 @@ def test_create_failed(self):
301
293
self .assertEqual (response .status_code , 200 )
302
294
self .assertEqual (response .template_name , ["vanilla/example_form.html" ])
303
295
self .assertFormError (
304
- response ,
305
- "form" ,
296
+ response .context_data ["form" ],
306
297
"text" ,
307
298
["Ensure this value has at most 10 characters (it has 700)." ],
308
299
)
@@ -379,8 +370,7 @@ def test_update_failed(self):
379
370
self .assertEqual (response .status_code , 200 )
380
371
self .assertEqual (response .template_name , ["vanilla/example_form.html" ])
381
372
self .assertFormError (
382
- response ,
383
- "form" ,
373
+ response .context_data ["form" ],
384
374
"text" ,
385
375
["Ensure this value has at most 10 characters (it has 700)." ],
386
376
)
@@ -614,8 +604,7 @@ def test_form_failure(self):
614
604
self .assertEqual (response .status_code , 200 )
615
605
self .assertEqual (response .template_name , ["example.html" ])
616
606
self .assertFormError (
617
- response ,
618
- "form" ,
607
+ response .context_data ["form" ],
619
608
"text" ,
620
609
["Ensure this value has at most 10 characters (it has 700)." ],
621
610
)
0 commit comments