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

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