Beispiel #1
0
 def testInvalidCaptcha(self):
     test_data = {
         "data": {
             "username": "******",
             "email": "*****@*****.**",
             "password1": "supersecure",
             "password2": "supersecure",
             "captcha": "randomstuff4321",
         },
         "error": ("captcha", [u"Liar! You don't seem to be human at all."]),
     }
     signup_form = MockSignupForm(data=test_data["data"])
     self.failIf(signup_form.is_valid())
     self.assertEqual(signup_form.errors[test_data["error"][0]], test_data["error"][1])
Beispiel #2
0
 def testEmptyCaptchaField(self):
     test_data = {
         "data": {
             "username": "******",
             "email": "*****@*****.**",
             "password1": "supersecure",
             "password2": "supersecure",
             "captcha": "",
         },
         "error": ("captcha", [u"This field is required."]),
     }
     signup_form = MockSignupForm(data=test_data["data"])
     self.failIf(signup_form.is_valid())
     self.assertEqual(signup_form.errors[test_data["error"][0]], test_data["error"][1])