コード例 #1
0
 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)
コード例 #2
0
 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)
コード例 #3
0
 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)
コード例 #4
0
 def tearDownClass(cls):
     with app.app_context():
         db.session.remove()
         db.drop_all()
コード例 #5
0
 def setUpClass(cls):
     with app.app_context():
         db.drop_all()
         db.create_all()
         db.session.add(TestUser(email=email))
         db.session.commit()
コード例 #6
0
 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())
コード例 #7
0
 def setUpClass(cls):
     with app.app_context():
         db.drop_all()
         db.create_all()