def test_stop_false(self):
     with app.app_context():
         with app.test_client() as c:
             c.post("/", data=dict(
                 email=email
             ))
             form = MockFormStopFalse()
             self.assertFalse(form.validate_on_submit())
             self.assertEqual(len(form.email.errors), 2)
 def test_fail_custom_callable_message(self):
     with app.app_context():
         with app.test_client() as c:
             c.post("/", data=dict(
                 email=email
             ))
             form = MockFormCustomCallableMessage()
             self.assertFalse(form.validate_on_submit())
             self.assertEqual(len(form.email.errors), 1)
             self.assertEqual(form.email.errors[0], R.string.validators.email_already_registered)
 def test_fail_default_message(self):
     with app.app_context():
         with app.test_client() as c:
             c.post("/", data=dict(
                 email=email
             ))
             form = MockForm()
             self.assertFalse(form.validate_on_submit())
             self.assertEqual(len(form.email.errors), 1)
             self.assertEqual(form.email.errors[0], R.string.validators.unique_field)
 def tearDownClass(cls):
     with app.app_context():
         db.session.remove()
         db.drop_all()
 def setUpClass(cls):
     with app.app_context():
         db.drop_all()
         db.create_all()
         db.session.add(TestUser(email=email))
         db.session.commit()
 def test(self):
     with app.app_context():
         with app.test_client() as c:
             c.post("/", data=dict(email="*****@*****.**"))
             form = MockForm()
             self.assertTrue(form.validate_on_submit())
 def setUpClass(cls):
     with app.app_context():
         db.drop_all()
         db.create_all()