Browse Source

Remove assertContains from user change email api tests

rafalp 6 years ago
parent
commit
edf73ad31f
1 changed files with 8 additions and 2 deletions
  1. 8 2
      misago/users/tests/test_user_changeemail_api.py

+ 8 - 2
misago/users/tests/test_user_changeemail_api.py

@@ -41,7 +41,10 @@ class UserChangeEmailTests(AuthenticatedUserTestCase):
                 'password': 'Lor3mIpsum',
                 'password': 'Lor3mIpsum',
             },
             },
         )
         )
-        self.assertContains(response, 'password is invalid', status_code=400)
+        self.assertEqual(response.status_code, 400)
+        self.assertEqual(response.json(), {
+            'password': ["Entered password is invalid."]
+        })
 
 
     def test_invalid_input(self):
     def test_invalid_input(self):
         """api errors correctly for invalid input"""
         """api errors correctly for invalid input"""
@@ -82,7 +85,10 @@ class UserChangeEmailTests(AuthenticatedUserTestCase):
                 'password': self.USER_PASSWORD,
                 'password': self.USER_PASSWORD,
             },
             },
         )
         )
-        self.assertContains(response, 'not available', status_code=400)
+        self.assertEqual(response.status_code, 400)
+        self.assertEqual(response.json(), {
+            'new_email': ["This e-mail address is not available."]
+        })
 
 
     def test_change_email(self):
     def test_change_email(self):
         """api allows users to change their e-mail addresses"""
         """api allows users to change their e-mail addresses"""