Вот код для забытого пароля API-вызова
def test_forgot_password(self):
"""
This test makes sure the forgot password api call is working ...
"""
data = {
'username' : self.user.email,
}
self.assertTrue(self.user.forgot_pw_hash is None)
response = self.c.post(reverse('api_forgot_password'), data, HTTP_X_REQUESTED_WITH='XMLHttpRequest')
# make sure there is an email in the out box and make sure
# the subject is correct
self.assertEquals(mail.outbox[0].subject,'Reset Password')
self.assertTrue(User.objects.get(email=self.user.email).forgot_pw_hash is not None)