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


Python TestEnv.curl_get方法代码示例

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


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

示例1: test_003_21

# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import curl_get [as 别名]
    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,代码行数:27,代码来源:test_003_get.py

示例2: test_201_01

# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import curl_get [as 别名]
 def test_201_01(self):
     url = TestEnv.mkurl("https", "test1", "/006/006.css")
     r = TestEnv.curl_get(url)
     assert 200 == r["response"]["status"]
     lm = r["response"]["header"]["last-modified"]
     assert lm
     r = TestEnv.curl_get(url, options=[ "-H", "if-modified-since: %s" % lm])
     assert 304 == r["response"]["status"]
     r = TestEnv.curl_get(url, options=[ "-H", "if-modified-since: Tue, 04 Sep 2010 11:51:59 GMT"])
     assert 200 == r["response"]["status"]
开发者ID:covener,项目名称:mod_h2,代码行数:12,代码来源:test_201_header_conditional.py

示例3: test_201_02

# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import curl_get [as 别名]
 def test_201_02(self):
     url = TestEnv.mkurl("https", "test1", "/006/006.css")
     r = TestEnv.curl_get(url)
     assert 200 == r["response"]["status"]
     etag = r["response"]["header"]["etag"]
     assert etag
     r = TestEnv.curl_get(url, options=[ "-H", "if-none-match: %s" % etag])
     assert 304 == r["response"]["status"]
     r = TestEnv.curl_get(url, options=[ "-H", "if-none-match: dummy"])
     assert 200 == r["response"]["status"]
开发者ID:covener,项目名称:mod_h2,代码行数:12,代码来源:test_201_header_conditional.py

示例4: test_003_02

# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import curl_get [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: test_002_01

# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import curl_get [as 别名]
 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,代码行数:9,代码来源:test_002_curl_basics.py

示例6: test_100_03

# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import curl_get [as 别名]
 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,代码行数:9,代码来源:test_100_conn_reuse.py

示例7: test_100_02

# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import curl_get [as 别名]
 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,代码行数:9,代码来源:test_100_conn_reuse.py

示例8: test_103_06

# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import curl_get [as 别名]
 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,代码行数:9,代码来源:test_103_upgrade.py

示例9: test_103_01

# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import curl_get [as 别名]
 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,代码行数:9,代码来源:test_103_upgrade.py

示例10: test_002_02

# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import curl_get [as 别名]
 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,代码行数:9,代码来源:test_002_curl_basics.py

示例11: test_003_01

# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import curl_get [as 别名]
    def test_003_01(self):
        url = TestEnv.mkurl("https", "cgi", "/hello.py")
        r = TestEnv.curl_get(url, 5)
        assert 200 == r["response"]["status"]
        assert "HTTP/2.0" == r["response"]["json"]["protocol"]
        assert "on" == r["response"]["json"]["https"]
        assert "TLSv1.2" == r["response"]["json"]["ssl_protocol"]
        assert "on" == r["response"]["json"]["h2"]
        assert "off" == r["response"]["json"]["h2push"]

        r = TestEnv.curl_get(url, 5, [ "--http1.1" ])
        assert 200 == r["response"]["status"]
        assert "HTTP/1.1" == r["response"]["json"]["protocol"]
        assert "on" == r["response"]["json"]["https"]
        assert "TLSv1.2" == r["response"]["json"]["ssl_protocol"]
        assert "" == r["response"]["json"]["h2"]
        assert "" == r["response"]["json"]["h2push"]
开发者ID:covener,项目名称:mod_h2,代码行数:19,代码来源:test_003_get.py

示例12: check_necho

# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import curl_get [as 别名]
 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,代码行数:10,代码来源:test_003_get.py

示例13: test_005_01

# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import curl_get [as 别名]
 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,代码行数:60,代码来源:test_005_status.py

示例14: test_600_01

# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import curl_get [as 别名]
 def test_600_01(self):
     url = TestEnv.mkurl("https", "cgi", "/h2proxy/hello.py")
     r = TestEnv.curl_get(url, 5)
     assert 200 == r["response"]["status"]
     assert "HTTP/2.0" == r["response"]["json"]["protocol"]
     assert "on" == r["response"]["json"]["https"]
     assert "" != r["response"]["json"]["ssl_protocol"]
     assert "on" == r["response"]["json"]["h2"]
     assert "off" == r["response"]["json"]["h2push"]
开发者ID:covener,项目名称:mod_h2,代码行数:11,代码来源:test_600_h2proxy.py

示例15: curl_upload_and_verify

# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import curl_get [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


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