当前位置: 首页>>代码示例>>Python>>正文


Python TestEnv.e2e_src方法代码示例

本文整理汇总了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"]
开发者ID:covener,项目名称:mod_h2,代码行数:15,代码来源:test_004_post.py

示例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"]
开发者ID:covener,项目名称:mod_h2,代码行数:13,代码来源:test_004_post.py

示例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"]
开发者ID:covener,项目名称:mod_h2,代码行数:15,代码来源:test_004_post.py

示例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"]
开发者ID:covener,项目名称:mod_h2,代码行数:17,代码来源:test_003_get.py

示例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"]
开发者ID:covener,项目名称:mod_h2,代码行数:18,代码来源:test_500_proxy.py


注:本文中的TestEnv.TestEnv.e2e_src方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。