@@ -51,7 +51,10 @@ def test_password_change_failure(self):
51
51
response = self .client .post (reverse ("password_change" ), data = data )
52
52
self .assertEqual (response .status_code , 200 )
53
53
self .assertFalse (response .context ["form" ].is_valid ())
54
- self .assertFormError (response , "form" , field = "old_password" , errors = msg )
54
+ if DJANGO_VERSION > (4 , 1 ):
55
+ self .assertFormError (response .context ["form" ], field = "old_password" , errors = msg )
56
+ else :
57
+ self .assertFormError (response , "form" , field = "old_password" , errors = msg )
55
58
self .client .logout ()
56
59
57
60
def test_password_change_success (self ):
@@ -108,7 +111,10 @@ def test_password_change_wrong_validators(self):
108
111
response = self .client .post (reverse ("password_change" ), data = data )
109
112
self .assertEqual (response .status_code , 200 )
110
113
self .assertFalse (response .context ["form" ].is_valid ())
111
- self .assertFormError (response , "form" , field = "new_password2" , errors = msg )
114
+ if DJANGO_VERSION > (4 , 1 ):
115
+ self .assertFormError (response .context ["form" ], field = "new_password2" , errors = msg )
116
+ else :
117
+ self .assertFormError (response , "form" , field = "new_password2" , errors = msg )
112
118
self .client .logout ()
113
119
114
120
def test_password_reset_complete (self ):
0 commit comments