Tests: minor fixes.
This commit is contained in:
@@ -15,7 +15,6 @@ class application:
|
||||
self.start(
|
||||
'200',
|
||||
[
|
||||
('Content-Type', self.environ.get('CONTENT_TYPE')),
|
||||
('Content-Length', str(len(body))),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -36,7 +36,6 @@ class TestAccessLog(TestApplicationPython):
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'keep-alive',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
start=True,
|
||||
body='01234',
|
||||
@@ -47,15 +46,7 @@ class TestAccessLog(TestApplicationPython):
|
||||
self.wait_for_record(r'"POST / HTTP/1.1" 200 5') is not None
|
||||
), 'keepalive 1'
|
||||
|
||||
resp = self.post(
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'close',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
sock=sock,
|
||||
body='0123456789',
|
||||
)
|
||||
resp = self.post(sock=sock, body='0123456789')
|
||||
|
||||
assert (
|
||||
self.wait_for_record(r'"POST / HTTP/1.1" 200 10') is not None
|
||||
@@ -315,16 +306,7 @@ Connection: close
|
||||
|
||||
self.set_format('$uri $body_bytes_sent')
|
||||
body = '0123456789' * 50
|
||||
self.post(
|
||||
url='/bbs',
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'close',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
body=body,
|
||||
read_timeout=1,
|
||||
)
|
||||
self.post(url='/bbs', body=body, read_timeout=1)
|
||||
assert (
|
||||
self.wait_for_record(r'^\/bbs ' + str(len(body)) + r'$') is not None
|
||||
), '$body_bytes_sent'
|
||||
|
||||
@@ -160,15 +160,7 @@ custom-header: BLAH
|
||||
assert self.get()['status'] == 200, 'init'
|
||||
|
||||
body = '0123456789AB' * 1024 * 1024 # 12 Mb
|
||||
resp = self.post(
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'close',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
body=body,
|
||||
read_buffer_size=1024 * 1024,
|
||||
)
|
||||
resp = self.post(body=body, read_buffer_size=1024 * 1024)
|
||||
|
||||
assert resp['body'] == body, 'keep-alive 1'
|
||||
|
||||
@@ -182,7 +174,6 @@ custom-header: BLAH
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'keep-alive',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
start=True,
|
||||
body=body,
|
||||
@@ -192,15 +183,7 @@ custom-header: BLAH
|
||||
assert resp['body'] == body, 'keep-alive 1'
|
||||
|
||||
body = '0123456789'
|
||||
resp = self.post(
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'close',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
sock=sock,
|
||||
body=body,
|
||||
)
|
||||
resp = self.post(sock=sock, body=body)
|
||||
|
||||
assert resp['body'] == body, 'keep-alive 2'
|
||||
|
||||
@@ -218,7 +201,6 @@ custom-header: BLAH
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'keep-alive',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
start=True,
|
||||
body=body,
|
||||
@@ -236,7 +218,6 @@ custom-header: BLAH
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'keep-alive',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
start=True,
|
||||
sock=socks[i],
|
||||
@@ -249,15 +230,7 @@ custom-header: BLAH
|
||||
self.load('mirror', processes=i + 1)
|
||||
|
||||
for i in range(conns):
|
||||
resp = self.post(
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'close',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
sock=socks[i],
|
||||
body=body,
|
||||
)
|
||||
resp = self.post(sock=socks[i], body=body)
|
||||
|
||||
assert resp['body'] == body, 'keep-alive close'
|
||||
|
||||
@@ -274,7 +247,6 @@ custom-header: BLAH
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'keep-alive',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
start=True,
|
||||
body=body,
|
||||
@@ -287,16 +259,7 @@ custom-header: BLAH
|
||||
|
||||
assert self.get()['status'] == 200, 'init'
|
||||
|
||||
(resp, sock) = self.post(
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'close',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
start=True,
|
||||
sock=sock,
|
||||
body=body,
|
||||
)
|
||||
(resp, sock) = self.post(start=True, sock=sock, body=body)
|
||||
|
||||
assert resp['status'] == 200, 'reconfigure 2 keep-alive 2'
|
||||
assert resp['body'] == '', 'reconfigure 2 keep-alive 2 body'
|
||||
|
||||
@@ -229,18 +229,12 @@ class TestConfiguration(TestControl):
|
||||
|
||||
def test_listeners_unix_abstract(self):
|
||||
if option.system != 'Linux':
|
||||
assert 'error' in self.conf(
|
||||
{"unix:@sock": {"pass": "routes"}}, 'listeners'
|
||||
), 'unix abstract at'
|
||||
assert 'error' in self.try_addr("unix:@sock"), 'abstract at'
|
||||
|
||||
pytest.skip('not yet')
|
||||
|
||||
assert 'error' in self.conf(
|
||||
{"unix:\0sock": {"pass": "routes"}}, 'listeners'
|
||||
), 'unix abstract zero'
|
||||
assert 'error' in self.conf(
|
||||
{"unix:\u0000sock": {"pass": "routes"}}, 'listeners'
|
||||
), 'unix abstract zero unicode'
|
||||
assert 'error' in self.try_addr("unix:\0soc"), 'abstract \0'
|
||||
assert 'error' in self.try_addr("unix:\u0000soc"), 'abstract \0 unicode'
|
||||
|
||||
def test_listeners_addr(self):
|
||||
assert 'success' in self.try_addr("*:7080"), 'wildcard'
|
||||
|
||||
@@ -95,7 +95,6 @@ class TestGoApplication(TestApplicationGo):
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'keep-alive',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
start=True,
|
||||
body=body,
|
||||
@@ -105,16 +104,7 @@ class TestGoApplication(TestApplicationGo):
|
||||
assert resp['body'] == body, 'keep-alive 1'
|
||||
|
||||
body = '0123456789'
|
||||
resp = self.post(
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Content-Type': 'text/html',
|
||||
'Connection': 'close',
|
||||
},
|
||||
sock=sock,
|
||||
body=body,
|
||||
)
|
||||
|
||||
resp = self.post(sock=sock, body=body)
|
||||
assert resp['body'] == body, 'keep-alive 2'
|
||||
|
||||
def test_go_application_cookies(self):
|
||||
|
||||
@@ -124,7 +124,6 @@ class TestNodeApplication(TestApplicationNode):
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'keep-alive',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
start=True,
|
||||
body=body,
|
||||
@@ -134,15 +133,7 @@ class TestNodeApplication(TestApplicationNode):
|
||||
assert resp['body'] == '0123456789' * 500, 'keep-alive 1'
|
||||
|
||||
body = '0123456789'
|
||||
resp = self.post(
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'close',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
sock=sock,
|
||||
body=body,
|
||||
)
|
||||
resp = self.post(sock=sock, body=body)
|
||||
|
||||
assert resp['body'] == body, 'keep-alive 2'
|
||||
|
||||
|
||||
@@ -226,7 +226,6 @@ opcache.preload_user = %(user)s
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'keep-alive',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
start=True,
|
||||
body=body,
|
||||
@@ -236,15 +235,7 @@ opcache.preload_user = %(user)s
|
||||
assert resp['body'] == body, 'keep-alive 1'
|
||||
|
||||
body = '0123456789'
|
||||
resp = self.post(
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'close',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
sock=sock,
|
||||
body=body,
|
||||
)
|
||||
resp = self.post(sock=sock, body=body)
|
||||
|
||||
assert resp['body'] == body, 'keep-alive 2'
|
||||
|
||||
|
||||
@@ -370,7 +370,6 @@ Content-Length: 10
|
||||
resp = self.post_http10(
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Content-Type': 'text/html',
|
||||
'Content-Length': str(len(body)),
|
||||
'X-Parts': '2',
|
||||
'X-Delay': '1',
|
||||
@@ -384,7 +383,6 @@ Content-Length: 10
|
||||
resp = self.post_http10(
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Content-Type': 'text/html',
|
||||
'Content-Length': str(len(body)),
|
||||
'X-Parts': '2',
|
||||
'X-Delay': '1',
|
||||
@@ -403,7 +401,6 @@ Content-Length: 10
|
||||
_, sock = self.post_http10(
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Content-Type': 'text/html',
|
||||
'Content-Length': '10000',
|
||||
'X-Parts': '3',
|
||||
'X-Delay': '1',
|
||||
@@ -419,7 +416,6 @@ Content-Length: 10
|
||||
_, sock = self.post_http10(
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Content-Type': 'text/html',
|
||||
'Content-Length': '10000',
|
||||
'X-Parts': '3',
|
||||
'X-Delay': '1',
|
||||
|
||||
@@ -138,14 +138,7 @@ custom-header: BLAH
|
||||
def test_python_application_ctx_iter_atexit(self):
|
||||
self.load('ctx_iter_atexit')
|
||||
|
||||
resp = self.post(
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'close',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
body='0123456789',
|
||||
)
|
||||
resp = self.post(body='0123456789')
|
||||
|
||||
assert resp['status'] == 200, 'ctx iter status'
|
||||
assert resp['body'] == '0123456789', 'ctx iter body'
|
||||
@@ -166,7 +159,6 @@ custom-header: BLAH
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'keep-alive',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
start=True,
|
||||
body=body,
|
||||
@@ -176,15 +168,7 @@ custom-header: BLAH
|
||||
assert resp['body'] == body, 'keep-alive 1'
|
||||
|
||||
body = '0123456789'
|
||||
resp = self.post(
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'close',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
sock=sock,
|
||||
body=body,
|
||||
)
|
||||
resp = self.post(sock=sock, body=body)
|
||||
|
||||
assert resp['body'] == body, 'keep-alive 2'
|
||||
|
||||
@@ -202,7 +186,6 @@ custom-header: BLAH
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'keep-alive',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
start=True,
|
||||
body=body,
|
||||
@@ -220,7 +203,6 @@ custom-header: BLAH
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'keep-alive',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
start=True,
|
||||
sock=socks[i],
|
||||
@@ -233,15 +215,7 @@ custom-header: BLAH
|
||||
self.load('mirror', processes=i + 1)
|
||||
|
||||
for i in range(conns):
|
||||
resp = self.post(
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'close',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
sock=socks[i],
|
||||
body=body,
|
||||
)
|
||||
resp = self.post(sock=socks[i], body=body)
|
||||
|
||||
assert resp['body'] == body, 'keep-alive close'
|
||||
|
||||
@@ -258,7 +232,6 @@ custom-header: BLAH
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'keep-alive',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
start=True,
|
||||
body=body,
|
||||
@@ -271,16 +244,7 @@ custom-header: BLAH
|
||||
|
||||
assert self.get()['status'] == 200, 'init'
|
||||
|
||||
(resp, sock) = self.post(
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'close',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
start=True,
|
||||
sock=sock,
|
||||
body=body,
|
||||
)
|
||||
(resp, sock) = self.post(start=True, sock=sock, body=body)
|
||||
|
||||
assert resp['status'] == 200, 'reconfigure 2 keep-alive 2'
|
||||
assert resp['body'] == '', 'reconfigure 2 keep-alive 2 body'
|
||||
|
||||
@@ -347,7 +347,6 @@ class TestRubyApplication(TestApplicationRuby):
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'keep-alive',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
start=True,
|
||||
body=body,
|
||||
@@ -357,15 +356,7 @@ class TestRubyApplication(TestApplicationRuby):
|
||||
assert resp['body'] == body, 'keep-alive 1'
|
||||
|
||||
body = '0123456789'
|
||||
resp = self.post(
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'close',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
sock=sock,
|
||||
body=body,
|
||||
)
|
||||
resp = self.post(sock=sock, body=body)
|
||||
|
||||
assert resp['body'] == body, 'keep-alive 2'
|
||||
|
||||
|
||||
@@ -505,7 +505,6 @@ basicConstraints = critical,CA:TRUE"""
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'keep-alive',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
start=True,
|
||||
body='0123456789',
|
||||
@@ -518,7 +517,6 @@ basicConstraints = critical,CA:TRUE"""
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'close',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
sock=sock,
|
||||
body='0123456789',
|
||||
@@ -570,9 +568,7 @@ basicConstraints = critical,CA:TRUE"""
|
||||
assert 'success' in self.conf_delete('/certificates/default')
|
||||
|
||||
try:
|
||||
resp = self.get_ssl(
|
||||
headers={'Host': 'localhost', 'Connection': 'close'}, sock=sock
|
||||
)
|
||||
resp = self.get_ssl(sock=sock)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
raise
|
||||
@@ -605,7 +601,6 @@ basicConstraints = critical,CA:TRUE"""
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'keep-alive',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
start=True,
|
||||
body='0123456789',
|
||||
@@ -622,15 +617,7 @@ basicConstraints = critical,CA:TRUE"""
|
||||
r' (?!' + app_id + r'#)(\d+)#\d+ "mirror" application started'
|
||||
)
|
||||
|
||||
resp = self.post_ssl(
|
||||
headers={
|
||||
'Host': 'localhost',
|
||||
'Connection': 'close',
|
||||
'Content-Type': 'text/html',
|
||||
},
|
||||
sock=sock,
|
||||
body='0123456789',
|
||||
)
|
||||
resp = self.post_ssl(sock=sock, body='0123456789')
|
||||
|
||||
assert resp['status'] == 200, 'application respawn status'
|
||||
assert resp['body'] == '0123456789', 'application respawn body'
|
||||
|
||||
Reference in New Issue
Block a user