You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
664 B
20 lines
664 B
from django.test import TestCase, Client
|
|
from django.urls import reverse
|
|
from django.core import mail
|
|
from django.contrib.auth import get_user_model
|
|
|
|
|
|
User = get_user_model()
|
|
|
|
|
|
class PasswordResetTest(TestCase):
|
|
def setUp(self):
|
|
self.url = reverse("lilcity:password_reset")
|
|
self.user = User.objects.create_user(username='Alice', email="example@example.com", password='1234')
|
|
self.client = Client()
|
|
|
|
def test_send_email_when_password_reset(self):
|
|
response = self.client.post(self.url, {"email": "example@example.com"})
|
|
|
|
self.assertEqual(True, response.json()["success"])
|
|
self.assertEqual(len(mail.outbox), 1)
|
|
|