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


Python TestEnv.TestEnv类代码示例

本文整理汇总了Python中TestEnv.TestEnv的典型用法代码示例。如果您正苦于以下问题:Python TestEnv类的具体用法?Python TestEnv怎么用?Python TestEnv使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TestEnv类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_200_03

 def test_200_03(self):
     url = TestEnv.mkurl("https", "cgi", "/hecho.py")
     for hex in [ "10", "7f" ]:
         r = TestEnv.curl_post_data(url, "name=x%%%s&value=yz" % hex)
         assert 0 != r["rv"]
         r = TestEnv.curl_post_data(url, "name=x&value=y%%%sz" % hex)
         assert 0 != r["rv"]
开发者ID:covener,项目名称:mod_h2,代码行数:7,代码来源:test_200_header_invalid.py

示例2: test_003_21

    def test_003_21(self):
        url = TestEnv.mkurl("https", "test1", "/index.html")
        r = TestEnv.curl_get(url, 5, [ "-I" ])
        assert 200 == r["response"]["status"]
        assert "HTTP/2" == r["response"]["protocol"]
        s = self.clean_header(r["response"]["body"])
        assert '''HTTP/2 200 
content-length: 2007
content-type: text/html

''' == s

        r = TestEnv.curl_get(url, 5, [ "-I", url ])
        assert 200 == r["response"]["status"]
        assert "HTTP/2" == r["response"]["protocol"]
        s = self.clean_header(r["response"]["body"])
        assert '''HTTP/2 200 
content-length: 2007
content-type: text/html

HTTP/2 200 
content-length: 2007
content-type: text/html

''' == s
开发者ID:covener,项目名称:mod_h2,代码行数:25,代码来源:test_003_get.py

示例3: test_400_32

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

示例4: test_002_01

 def test_002_01(self):
     url = TestEnv.mkurl("http", "test1", "/alive.json")
     r = TestEnv.curl_get(url, 5)
     assert 200 == r["response"]["status"]
     assert "HTTP/1.1" == r["response"]["protocol"]
     assert True == r["response"]["json"]["alive"]
     assert "test1" == r["response"]["json"]["host"]
开发者ID:covener,项目名称:mod_h2,代码行数:7,代码来源:test_002_curl_basics.py

示例5: test_002_02

 def test_002_02(self):
     url = TestEnv.mkurl("https", "test1", "/alive.json")
     r = TestEnv.curl_get(url, 5)
     assert 200 == r["response"]["status"]
     assert True == r["response"]["json"]["alive"]
     assert "test1" == r["response"]["json"]["host"]
     assert "application/json" == r["response"]["header"]["content-type"]
开发者ID:covener,项目名称:mod_h2,代码行数:7,代码来源:test_002_curl_basics.py

示例6: test_100_02

 def test_100_02(self):
     url = TestEnv.mkurl("https", "cgi", "/hello.py")
     hostname = ("cgi-alias.%s" % TestEnv.HTTP_TLD)
     r = TestEnv.curl_get(url, 5, [ "-H", "Host:%s" % hostname ])
     assert 200 == r["response"]["status"]
     assert "HTTP/2" == r["response"]["protocol"]
     assert hostname == r["response"]["json"]["host"]
开发者ID:covener,项目名称:mod_h2,代码行数:7,代码来源:test_100_conn_reuse.py

示例7: test_100_03

 def test_100_03(self):
     url = TestEnv.mkurl("https", "cgi", "/")
     hostname = ("test1.%s" % TestEnv.HTTP_TLD)
     r = TestEnv.curl_get(url, 5, [ "-H", "Host:%s" % hostname ])
     assert 200 == r["response"]["status"]
     assert "HTTP/2" == r["response"]["protocol"]
     assert "text/html" == r["response"]["header"]["content-type"]
开发者ID:covener,项目名称:mod_h2,代码行数:7,代码来源:test_100_conn_reuse.py

示例8: test_103_01

 def test_103_01(self):
     url = TestEnv.mkurl("http", "test1", "/index.html")
     r = TestEnv.curl_get(url)
     assert 0 == r["rv"]
     assert "response" in r
     assert "upgrade" in r["response"]["header"]
     assert "h2c" == r["response"]["header"]["upgrade"]
开发者ID:covener,项目名称:mod_h2,代码行数:7,代码来源:test_103_upgrade.py

示例9: test_103_06

 def test_103_06(self):
     url = TestEnv.mkurl("https", "test1", "/index.html")
     r = TestEnv.curl_get(url, options=[ "--http1.1" ])
     assert 0 == r["rv"]
     assert "response" in r
     assert "upgrade" in r["response"]["header"]
     assert "h2" == r["response"]["header"]["upgrade"]
开发者ID:covener,项目名称:mod_h2,代码行数:7,代码来源:test_103_upgrade.py

示例10: test_400_07

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

示例11: nghttp_upload_stat

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

示例12: test_006_02

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

示例13: check_necho

 def check_necho(self, n, text):
     url = TestEnv.mkurl("https", "cgi", "/necho.py")
     r = TestEnv.curl_get(url, 5, [ "-F", ("count=%d" % (n)), "-F", ("text=%s" % (text)) ])
     assert 200 == r["response"]["status"]
     exp = ""
     for i in range(n):
         exp += text + "\n"
     assert exp == r["response"]["body"]
开发者ID:covener,项目名称:mod_h2,代码行数:8,代码来源:test_003_get.py

示例14: test_005_01

 def test_005_01(self):
     url = TestEnv.mkurl("https", "cgi", "/.well-known/h2/state")
     r = TestEnv.curl_get(url, 5)
     assert 200 == r["response"]["status"]
     st = r["response"]["json"]
     
     # remove some parts that are very dependant on client/lib versions
     # or connection time etc.
     del st["settings"]["SETTINGS_INITIAL_WINDOW_SIZE"]
     del st["peerSettings"]["SETTINGS_INITIAL_WINDOW_SIZE"]
     del st["streams"]["1"]["created"]
     del st["streams"]["1"]["flowOut"]
     del st["stats"]["in"]["frames"]
     del st["stats"]["in"]["octets"]
     del st["stats"]["out"]["frames"]
     del st["stats"]["out"]["octets"]
     del st["connFlowOut"]
     
     assert st == {
         "version" : "draft-01",
         "settings" : {
             "SETTINGS_MAX_CONCURRENT_STREAMS": 100,
             "SETTINGS_MAX_FRAME_SIZE": 16384,
             "SETTINGS_ENABLE_PUSH": 0
         },
         "peerSettings" : {
             "SETTINGS_MAX_CONCURRENT_STREAMS": 100,
             "SETTINGS_MAX_FRAME_SIZE": 16384,
             "SETTINGS_ENABLE_PUSH": 0,
             "SETTINGS_HEADER_TABLE_SIZE": 4096,
             "SETTINGS_MAX_HEADER_LIST_SIZE": -1
         },
         "connFlowIn": 2147483647,
         "sentGoAway": 0,
         "streams": {
             "1": {
                 "state": "HALF_CLOSED_REMOTE",
                 "flowIn": 65535,
                 "dataIn": 0,
                 "dataOut": 0
             }
         },
         "stats": {
             "in": {
                 "requests": 1,
                 "resets": 0, 
             },
             "out": {
                 "responses": 0,
             },
             "push": {
                 "cacheDigest": "AQg",
                 "promises": 0,
                 "submits": 0,
                 "resets": 0
             }
         }
     }
开发者ID:covener,项目名称:mod_h2,代码行数:58,代码来源:test_005_status.py

示例15: test_400_52

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


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