本文整理汇总了Python中TestEnv.TestEnv.mkurl方法的典型用法代码示例。如果您正苦于以下问题:Python TestEnv.mkurl方法的具体用法?Python TestEnv.mkurl怎么用?Python TestEnv.mkurl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestEnv.TestEnv
的用法示例。
在下文中一共展示了TestEnv.mkurl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_100_01
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import mkurl [as 别名]
def test_100_01(self):
# this host defaults to h2, but we can request h1
url = TestEnv.mkurl("https", "cgi", "/hello.py")
assert "2" == TestEnv.curl_protocol_version( url )
assert "1.1" == TestEnv.curl_protocol_version( url, options=[ "--http1.1" ] )
# this host does not enable h2, it always falls back to h1
url = TestEnv.mkurl("https", "noh2", "/hello.py")
assert "1.1" == TestEnv.curl_protocol_version( url )
assert "1.1" == TestEnv.curl_protocol_version( url, options=[ "--http2" ] )
示例2: test_003_02
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import mkurl [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"]
示例3: test_002_02
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import mkurl [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"]
示例4: test_200_03
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import mkurl [as 别名]
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"]
示例5: test_103_01
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import mkurl [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"]
示例6: test_100_02
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import mkurl [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"]
示例7: test_103_06
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import mkurl [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"]
示例8: test_002_01
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import mkurl [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"]
示例9: test_400_32
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import mkurl [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"]
示例10: test_400_07
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import mkurl [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"]
示例11: test_100_03
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import mkurl [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"]
示例12: test_003_21
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import mkurl [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
示例13: check_necho
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import mkurl [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"]
示例14: nghttp_upload_stat
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import mkurl [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"]
示例15: test_006_02
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import mkurl [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" }
]