Exemplo n.º 1
0
    def test_normal_post(self):
        middleware = []
        testApp = TestApp(app.wsgifunc(*middleware))

        r = testApp.post('/add_comment', params=self.correct_comment_params)
        assert_equal(r.status, 200)
        r.mustcontain("Thank you for your comment")
Exemplo n.º 2
0
    def test_size(self):
        middleware = []
        testApp = TestApp(app.wsgifunc(*middleware))

        comment_params = dict(self.correct_comment_params)
        comment_params['content'] = "a" * 100000

        r = testApp.post('/add_comment', params=comment_params)
        assert_equal(r.status, 200)
        r.mustcontain("Thank you for your comment")

        comment_params['content'] = "a" * 102400
        with assert_raises(ValueError):
            testApp.post('/add_comment', params=comment_params, expect_errors=True)
Exemplo n.º 3
0
 def test_get(self):
     middleware = []
     testApp = TestApp(app.wsgifunc(*middleware))
     r = testApp.get('/add_comment', params=self.correct_comment_params, status=405)
     assert_equal(r.status, 405)
Exemplo n.º 4
0
 def test_index(self):
     middleware = []
     testApp = TestApp(app.wsgifunc(*middleware))
     r = testApp.get('/', status=404)
     assert_equal(r.status, 404)