本文整理汇总了Python中TestEnv.TestEnv.e2e_src方法的典型用法代码示例。如果您正苦于以下问题:Python TestEnv.e2e_src方法的具体用法?Python TestEnv.e2e_src怎么用?Python TestEnv.e2e_src使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestEnv.TestEnv
的用法示例。
在下文中一共展示了TestEnv.e2e_src方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_nghttp_body
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import e2e_src [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"]
示例2: nghttp_post_and_verify
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import e2e_src [as 别名]
def nghttp_post_and_verify(self, fname, options=None):
url = TestEnv.mkurl("https", "cgi", "/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"]
示例3: curl_upload_and_verify
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import e2e_src [as 别名]
def curl_upload_and_verify(self, fname, options=None):
url = TestEnv.mkurl("https", "cgi", "/upload.py")
fpath = os.path.join(TestEnv.GEN_DIR, fname)
r = TestEnv.curl_upload(url, fpath, options=options)
assert r["rv"] == 0
assert r["response"]["status"] >= 200 and r["response"]["status"] < 300
r2 = TestEnv.curl_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"]
示例4: test_003_02
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import e2e_src [as 别名]
def test_003_02(self):
with open(TestEnv.e2e_src( "htdocs/test1/index.html"), mode='rb') as file:
src = file.read()
url = TestEnv.mkurl("https", "test1", "/index.html")
r = TestEnv.curl_get(url, 5)
assert 200 == r["response"]["status"]
assert "HTTP/2" == r["response"]["protocol"]
assert src == r["response"]["body"]
url = TestEnv.mkurl("https", "test1", "/index.html")
r = TestEnv.curl_get(url, 5, [ "--http1.1" ])
assert 200 == r["response"]["status"]
assert "HTTP/1.1" == r["response"]["protocol"]
assert src == r["response"]["body"]
示例5: nghttp_upload_and_verify
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import e2e_src [as 别名]
def nghttp_upload_and_verify(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"]
# why is the scheme wrong?
r2 = TestEnv.nghttp().get(re.sub(r'http:', 'https:', 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"]