summaryrefslogtreecommitdiffhomepage
path: root/test/unit/http.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/http.py')
-rw-r--r--test/unit/http.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/test/unit/http.py b/test/unit/http.py
index 347382f5..9401501b 100644
--- a/test/unit/http.py
+++ b/test/unit/http.py
@@ -7,13 +7,14 @@ import select
import socket
import pytest
+
from unit.option import option
class HTTP1:
def http(self, start_str, **kwargs):
sock_type = kwargs.get('sock_type', 'ipv4')
- port = kwargs.get('port', 7080)
+ port = kwargs.get('port', 8080)
url = kwargs.get('url', '/')
http = 'HTTP/1.0' if 'http_10' in kwargs else 'HTTP/1.1'
@@ -38,10 +39,7 @@ class HTTP1:
if 'sock' not in kwargs:
sock = socket.socket(sock_types[sock_type], socket.SOCK_STREAM)
- if (
- sock_type == sock_types['ipv4']
- or sock_type == sock_types['ipv6']
- ):
+ if sock_type in (sock_types['ipv4'], sock_types['ipv6']):
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
if 'wrapper' in kwargs:
@@ -202,7 +200,7 @@ class HTTP1:
data += part
- if not len(part):
+ if not part:
break
return data
@@ -263,7 +261,7 @@ class HTTP1:
size = int(chunks.pop(0), 16)
except ValueError:
- pytest.fail(f'Invalid chunk size {size}')
+ pytest.fail('Invalid chunk size')
if size == 0:
assert len(chunks) == 1, 'last zero size'