本文整理汇总了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"]
示例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
示例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"]
示例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"]
示例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"]
示例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"]
示例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"]
示例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"]
示例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"]
示例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"]
示例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"]
示例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" }
]
示例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"]
示例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
}
}
}
示例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"])