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.
 
 
 
 
 

17 lines
524 B

from django.contrib.auth.models import User
from django.test import TestCase
class CheckTokenTestCase(TestCase):
def test_it_redirects(self):
alice = User(username="alice")
alice.set_password("secret-token")
alice.save()
r = self.client.get("/accounts/check_token/alice/secret-token/")
assert r.status_code == 302
# After login, password should be unusable
alice_again = User.objects.get(username="alice")
assert not alice_again.has_usable_password()