Exemplo n.º 1
0
    def test_passwords_dont_match(self):
        # Test that two passwords do not match.
        passwords = {"password": self.get_test_password(), "confirm_password": self.get_test_password()}

        form = ResetPasswordForm(passwords)
        self.assertFalse(form.is_valid())
        self.assertEqual(form["confirm_password"].errors, [u"The two passwords do not match."])
Exemplo n.º 2
0
 def test_success(self):
     # Test that form is valid with correct passwords.
     password = self.get_test_password()
     passwords = {
         'password': password,
         'confirm_password': password
     }
     form = ResetPasswordForm(passwords)
     self.assertTrue(form.is_valid())
Exemplo n.º 3
0
    def test_password_length(self):
        # Test that password length is valid.
        password = self.get_test_password(4)
        passwords = {"password": password, "confirm_password": password}

        form = ResetPasswordForm(passwords)
        self.assertFalse(form.is_valid())
        self.assertEqual(
            form["password"].errors, [u"Ensure this value has at least 5 characters (it has %d)." % len(password)]
        )
Exemplo n.º 4
0
    def test_passwords_dont_match(self):
        # Test that two passwords do not match.
        passwords = {
            'password': self.get_test_password(),
            'confirm_password': self.get_test_password()
        }

        form = ResetPasswordForm(passwords)
        self.assertFalse(form.is_valid())
        self.assertEqual(form['confirm_password'].errors,
                         [u'The two passwords do not match.'])