http.py (1635:97afbb6c5a15) http.py (1654:fc7d0578e124)
1import binascii
2import io
3import json
4import os
5import re
6import select
7import socket
1import binascii
2import io
3import json
4import os
5import re
6import select
7import socket
8import time
9
10import pytest
11from conftest import option
12from unit.main import TestUnit
13
14
15class TestHTTP(TestUnit):
16 def http(self, start_str, **kwargs):

--- 261 unchanged lines hidden (view full) ---

278
279 resp['body'] = json.loads(resp['body'])
280
281 return resp
282
283 def getjson(self, **kwargs):
284 return self.get(json=True, **kwargs)
285
8
9import pytest
10from conftest import option
11from unit.main import TestUnit
12
13
14class TestHTTP(TestUnit):
15 def http(self, start_str, **kwargs):

--- 261 unchanged lines hidden (view full) ---

277
278 resp['body'] = json.loads(resp['body'])
279
280 return resp
281
282 def getjson(self, **kwargs):
283 return self.get(json=True, **kwargs)
284
286 def waitforsocket(self, port):
287 ret = False
288
289 for i in range(50):
290 try:
291 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
292 sock.connect(('127.0.0.1', port))
293 ret = True
294 break
295 except:
296 sock.close()
297 time.sleep(0.1)
298
299 sock.close()
300
301 assert ret, 'socket connected'
302
303 def form_encode(self, fields):
304 is_multipart = False
305
306 for _, value in fields.items():
307 if isinstance(value, dict):
308 is_multipart = True
309 break
310

--- 57 unchanged lines hidden ---
285 def form_encode(self, fields):
286 is_multipart = False
287
288 for _, value in fields.items():
289 if isinstance(value, dict):
290 is_multipart = True
291 break
292

--- 57 unchanged lines hidden ---