本文整理汇总了Python中TestEnv.TestEnv.nghttp方法的典型用法代码示例。如果您正苦于以下问题:Python TestEnv.nghttp方法的具体用法?Python TestEnv.nghttp怎么用?Python TestEnv.nghttp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestEnv.TestEnv
的用法示例。
在下文中一共展示了TestEnv.nghttp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_400_20
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import nghttp [as 别名]
def test_400_20(self):
url = TestEnv.mkurl("https", "push", "/006-push20.html")
r = TestEnv.nghttp().get(url)
assert 200 == r["response"]["status"]
promises = r["streams"][r["response"]["id"]]["promises"]
assert 2 == len(promises)
fpath = os.path.join(TestEnv.GEN_DIR, "data-400-20")
with open(fpath, 'w') as f:
f.write("test upload data")
r = TestEnv.nghttp().upload(url, fpath)
assert 200 == r["response"]["status"]
promises = r["streams"][r["response"]["id"]]["promises"]
assert 0 == len(promises)
示例2: nghttp_upload_and_verify
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import nghttp [as 别名]
def nghttp_upload_and_verify(self, fname, options=None):
url = TestEnv.mkurl("https", "cgi", "/upload.py")
fpath = os.path.join(TestEnv.GEN_DIR, fname)
r = TestEnv.nghttp().upload_file(url, fpath, options=options)
assert r["rv"] == 0
assert r["response"]["status"] >= 200 and r["response"]["status"] < 300
assert r["response"]["header"]["location"]
r2 = TestEnv.nghttp().get(r["response"]["header"]["location"])
assert r2["rv"] == 0
assert r2["response"]["status"] == 200
with open(TestEnv.e2e_src( fpath ), mode='rb') as file:
src = file.read()
assert src == r2["response"]["body"]
示例3: test_400_32
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import nghttp [as 别名]
def test_400_32(self):
url = TestEnv.mkurl("https", "hints", "/006-nohints.html")
r = TestEnv.nghttp().get(url)
assert 200 == r["response"]["status"]
promises = r["streams"][r["response"]["id"]]["promises"]
assert 1 == len(promises)
assert not "previous" in r["response"]
示例4: test_400_07
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import nghttp [as 别名]
def test_400_07(self):
url = TestEnv.mkurl("https", "push", "/006-push7.html")
r = TestEnv.nghttp().get(url)
assert 200 == r["response"]["status"]
promises = r["streams"][r["response"]["id"]]["promises"]
assert 1 == len(promises)
assert '/006/006.css' == promises[0]["request"]["header"][":path"]
示例5: test_006_02
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import nghttp [as 别名]
def test_006_02(self):
url = TestEnv.mkurl("https", "test1", "/002.jpg")
r = TestEnv.nghttp().assets(url)
assert 0 == r["rv"]
assert 1 == len(r["assets"])
assert r["assets"] == [
{ "status": 200, "size": "88K", "path" : "/002.jpg" }
]
示例6: nghttp_upload_stat
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import nghttp [as 别名]
def nghttp_upload_stat(self, fname, options=None):
url = TestEnv.mkurl("https", "cgi", "/proxy/upload.py")
fpath = os.path.join(TestEnv.GEN_DIR, fname)
r = TestEnv.nghttp().upload_file(url, fpath, options=options)
assert r["rv"] == 0
assert r["response"]["status"] >= 200 and r["response"]["status"] < 300
assert r["response"]["header"]["location"]
示例7: test_006_05
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import nghttp [as 别名]
def test_006_05(self):
url = TestEnv.mkurl("https", "test1", "/003.html")
r = TestEnv.nghttp().assets(url, options=[ "--window-bits=24" ])
assert 0 == r["rv"]
assert 2 == len(r["assets"])
assert r["assets"] == [
{ "status": 200, "size": "316", "path": "/003.html" },
{ "status": 200, "size": "88K", "path": "/003/003_img.jpg" }
]
示例8: test_400_52
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import nghttp [as 别名]
def test_400_52(self):
url = TestEnv.mkurl("https", "push", "/006-push.html")
r = TestEnv.nghttp().get(url, options=[ '-H', 'accept-push-policy: head'])
assert 200 == r["response"]["status"]
promises = r["streams"][r["response"]["id"]]["promises"]
assert 1 == len(promises)
assert '/006/006.css' == promises[0]["request"]["header"][":path"]
assert "" == promises[0]["response"]["body"]
assert 0 == len(promises[0]["response"]["body"])
示例9: test_006_04
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import nghttp [as 别名]
def test_006_04(self):
url = TestEnv.mkurl("https", "test1", "/006.html")
r = TestEnv.nghttp().assets(url)
assert 0 == r["rv"]
assert 3 == len(r["assets"])
assert r["assets"] == [
{ "status": 200, "size": "543", "path": "/006.html" },
{ "status": 200, "size": "216", "path": "/006/006.css" },
{ "status": 200, "size": "839", "path": "/006/006.js" }
]
示例10: test_400_31
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import nghttp [as 别名]
def test_400_31(self):
url = TestEnv.mkurl("https", "hints", "/006-hints.html")
r = TestEnv.nghttp().get(url)
assert 200 == r["response"]["status"]
promises = r["streams"][r["response"]["id"]]["promises"]
assert 1 == len(promises)
early = r["response"]["previous"]
assert early
assert 103 == int(early["header"][":status"])
assert early["header"]["link"]
示例11: nghttp_post_and_verify
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import nghttp [as 别名]
def nghttp_post_and_verify(self, fname, options=None):
url = TestEnv.mkurl("https", "cgi", "/proxy/echo.py")
fpath = os.path.join(TestEnv.GEN_DIR, fname)
r = TestEnv.nghttp().upload(url, fpath, options=options)
assert r["rv"] == 0
assert r["response"]["status"] >= 200 and r["response"]["status"] < 300
with open(TestEnv.e2e_src( fpath ), mode='rb') as file:
src = file.read()
assert src == r["response"]["body"]
示例12: check_nghttp_body
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import nghttp [as 别名]
def check_nghttp_body(self, ref_input, nghttp_output):
with open(TestEnv.e2e_src( os.path.join(TestEnv.GEN_DIR, ref_input) ), mode='rb') as f:
refbody = f.read()
with open(TestEnv.e2e_src( nghttp_output), mode='rb') as f:
text = f.read()
o = TestEnv.nghttp().parse_output(text)
assert "response" in o
assert "body" in o["response"]
if refbody != o["response"]["body"]:
with open(TestEnv.e2e_src( os.path.join(TestEnv.GEN_DIR, '%s.parsed' % ref_input) ), mode='wb') as f:
f.write( o["response"]["body"] )
assert len(refbody) == len(o["response"]["body"])
assert refbody == o["response"]["body"]
示例13: test_103_23
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import nghttp [as 别名]
def test_103_23(self):
url = TestEnv.mkurl("http", "test1b", "/index.html")
r = TestEnv.nghttp().get(url, options=[ "-u" ])
assert not "response" in r
示例14: test_103_21
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import nghttp [as 别名]
def test_103_21(self):
url = TestEnv.mkurl("http", "test2", "/index.html")
r = TestEnv.nghttp().get(url, options=[ "-u" ])
assert 404 == r["response"]["status"]
示例15: test_400_00
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import nghttp [as 别名]
def test_400_00(self):
url = TestEnv.mkurl("https", "push", "/006.html")
r = TestEnv.nghttp().get(url)
assert 200 == r["response"]["status"]
promises = r["streams"][r["response"]["id"]]["promises"]
assert 0 == len(promises)