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.http_request("002.http")
def http_request(req):
def test_002(req):
e = req.read()
t.eq(e['REQUEST_METHOD'], 'GET')
t.eq(e['PATH_INFO'], "/test")
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_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()
t.eq(body, '')

View File

@ -69,7 +69,7 @@ class http_request(object):
def run():
fsock = FakeSocket(data_source(self.fname))
req = HttpRequest(fsock, ('127.0.0.1', 6000),
('127.0.0.1', 8000))
('127.0.0.1', 8000))
func(req)
run.func_name = func.func_name
return run