예제 #1
0
    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)
예제 #2
0
    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)
예제 #3
0
 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)
예제 #4
0
 def setUp(self):
     super(TestEmailChange, self).setUp()
     self.token, self.hash = EmailResetCode.create(self.user.id, "*****@*****.**")
예제 #5
0
 def setUp(self):
     super(TestEmailChange, self).setUp()
     self.token, self.hash = EmailResetCode.create(self.user.id,
                                                   '*****@*****.**')
예제 #6
0
 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)