def test_common_request_descriptors_mixin(self):
request = wrappers.Request.from_values(content_type='text/html; charset=utf-8',
content_length='23',
headers={
'Referer': 'http://www.example.com/',
'Date': 'Sat, 28 Feb 2009 19:04:35 GMT',
'Max-Forwards': '10',
'Pragma': 'no-cache',
'Content-Encoding': 'gzip',
'Content-MD5': '9a3bc6dbc47a70db25b84c6e5867a072'
})
self.assert_equal(request.content_type, 'text/html; charset=utf-8')
self.assert_equal(request.mimetype, 'text/html')
self.assert_equal(request.mimetype_params, {'charset': 'utf-8'})
self.assert_equal(request.content_length, 23)
self.assert_equal(request.referrer, 'http://www.example.com/')
self.assert_equal(request.date, datetime(2009, 2, 28, 19, 4, 35))
self.assert_equal(request.max_forwards, 10)
self.assert_true('no-cache' in request.pragma)
self.assert_equal(request.content_encoding, 'gzip')
self.assert_equal(request.content_md5, '9a3bc6dbc47a70db25b84c6e5867a072')
评论列表
文章目录