Beispiel #1
0
    def test_handle_request_exception(self):
        resp = self.c.get('/', {'exc': 0})
        eq_(resp.code, 401)
        eq_(str_(resp.body), EXC_MSG_0)

        resp = self.c.get('/', {'exc': 1})
        eq_(resp.code, 400)
        eq_(str_(resp.body), EXC_MSG_1)

        resp = self.c.get('/', {'exc': 2})
        eq_(resp.code, 400)
        eq_(str_(resp.body), EXC_MSG_2)
Beispiel #2
0
    def test_header_change(self):
        h = 'darling kiss me'
        name = 'Torext-Special'
        rv = self.c.get('/header', {'h': name}, headers={name: h})

        eq_(rv.headers.get(name), h)
        eq_(str_(rv.body), h)
Beispiel #3
0
    def test_file_write(self):
        resp = self.c.get('/file')
        print(repr(resp.body))
        eq_(str_(resp.body), FILE_CONTENT)

        eq_(resp.headers.get('Content-Type'), 'text/plain')
        assert 'Last-Modified' in resp.headers
        assert 'ETag' in resp.headers
Beispiel #4
0
 def test_decode_signed_value(self):
     resp = self.c.get('/cookie')
     print(resp.cookies)
     resp_post = self.c.post('/cookie', cookies=resp.cookies)
     print(repr(resp_post.body))
     eq_(str_(resp_post.body), SIGNED_RAW_VALUE)
Beispiel #5
0
 def test_post_data(self):
     d = 'in other words'
     rv = self.c.post('/withdata', {'d': d})
     eq_(str_(rv.body), d)
Beispiel #6
0
 def test_get_params(self):
     p = 'fly me to the moon'
     rv = self.c.get('/withdata', {'p': p})
     eq_(str_(rv.body), p)
Beispiel #7
0
 def test_post(self):
     rv = self.c.post('/')
     eq_(str_(rv.body), POST_RESULT)
Beispiel #8
0
 def test_get(self):
     rv = self.c.get('/')
     eq_(str_(rv.body), GET_RESULT)