This commit is contained in:
Benoit Chesneau 2010-01-21 01:20:09 +01:00
parent ec644bdf90
commit 2f959f9251
2 changed files with 3 additions and 9 deletions

View File

@ -23,20 +23,14 @@ def test_001(req):
t.eq(body, '{"nom": "nom"}') t.eq(body, '{"nom": "nom"}')
@t.http_request("002.http") @t.http_request("002.http")
def http_request(req): def test_002(req):
e = req.read() e = req.read()
t.eq(e['REQUEST_METHOD'], 'GET') t.eq(e['REQUEST_METHOD'], 'GET')
t.eq(e['PATH_INFO'], "/test") t.eq(e['PATH_INFO'], "/test")
t.eq(e['QUERY_STRING'], "") t.eq(e['QUERY_STRING'], "")
t.eq(sorted(p.headers), [
("Accept", "*/*"),
("Host", "0.0.0.0=5000"),
("User-Agent", "curl/7.18.0 (i486-pc-linux-gnu) libcurl/7.18.0 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.1")
])
t.eq(e['HTTP_ACCEPT'], "*/*") t.eq(e['HTTP_ACCEPT'], "*/*")
t.eq(e['HTTP_HOST'], "0.0.0.0=5000") t.eq(e['HTTP_HOST'], "0.0.0.0=5000")
t.eq(e['HTTP_USER_AGENT', "curl/7.18.0 (i486-pc-linux-gnu) libcurl/7.18.0 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.1"]) t.eq(e['HTTP_USER_AGENT'], "curl/7.18.0 (i486-pc-linux-gnu) libcurl/7.18.0 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.1")
body = e['wsgi.input'].read() body = e['wsgi.input'].read()
t.eq(body, '') t.eq(body, '')