def test_parse(self): id = 1 mail = '*****@*****.**' token, hash = EmailResetCode.create(id, mail) r_id, r_mail = EmailResetCode.parse(token, hash) eq_(id, r_id) eq_(mail, r_mail) # A bad token or hash raises ValueError self.assertRaises(ValueError, EmailResetCode.parse, token, hash[:-5]) self.assertRaises(ValueError, EmailResetCode.parse, token[5:], hash)
def test_email_change_to_an_existing_user_email(self): token, hash_ = EmailResetCode.create(self.user.id, "*****@*****.**") url = reverse("users.emailchange", args=[self.user.id, token, hash_]) r = self.client.get(url, follow=True) eq_(r.status_code, 400)
def setUp(self): super(TestEmailChange, self).setUp() self.token, self.hash = EmailResetCode.create(self.user.id, "*****@*****.**")
def setUp(self): super(TestEmailChange, self).setUp() self.token, self.hash = EmailResetCode.create(self.user.id, '*****@*****.**')
def test_email_change_to_an_existing_user_email(self): token, hash_ = EmailResetCode.create(self.user.id, '*****@*****.**') url = reverse('users.emailchange', args=[self.user.id, token, hash_]) r = self.client.get(url, follow=True) eq_(r.status_code, 400)