enabled test_web.py in PY3
This commit is contained in:
@@ -14,7 +14,8 @@ names = localhost:*, 127.0.0.1:*, *:*, *
|
||||
[db]
|
||||
uri = sqlite://storage.sqlite
|
||||
migrate = true
|
||||
pool_size = 10 ; ignored for sqlite
|
||||
; ignored for sqlite
|
||||
pool_size = 10
|
||||
|
||||
; smtp address and credentials
|
||||
[smtp]
|
||||
@@ -27,4 +28,4 @@ ssl = true
|
||||
; form styling
|
||||
[forms]
|
||||
formstyle = bootstrap3_inline
|
||||
separator =
|
||||
separator =
|
||||
|
||||
@@ -137,7 +137,10 @@ class WebClient(object):
|
||||
self.status = None
|
||||
|
||||
self.text = to_native(self.response.read())
|
||||
self.headers = dict(self.response.headers)
|
||||
# In PY3 self.response.headers are case sensitive
|
||||
self.headers = dict()
|
||||
for h in self.response.headers:
|
||||
self.headers[h.lower()] = self.response.headers[h]
|
||||
|
||||
# treat web2py tickets as special types of errors
|
||||
if error is not None:
|
||||
@@ -146,9 +149,6 @@ class WebClient(object):
|
||||
else:
|
||||
raise error
|
||||
|
||||
if 'Set-Cookie' in self.headers: #PY3
|
||||
self.headers['set-cookie'] = self.headers['Set-Cookie']
|
||||
|
||||
# parse headers into cookies
|
||||
self.cookies = {}
|
||||
if 'set-cookie' in self.headers:
|
||||
|
||||
@@ -20,9 +20,9 @@ from .test_serializers import *
|
||||
from .test_languages import *
|
||||
from .test_compileapp import *
|
||||
from .test_appadmin import *
|
||||
from .test_web import *
|
||||
|
||||
if sys.version[:3] == '2.7':
|
||||
from .test_is_url import *
|
||||
from .test_scheduler import *
|
||||
from .test_web import *
|
||||
from .test_old_doctests import *
|
||||
|
||||
@@ -16,7 +16,7 @@ from .fix_path import fix_sys_path
|
||||
fix_sys_path(__file__)
|
||||
|
||||
from gluon.contrib.webclient import WebClient
|
||||
from gluon._compat import urllib2
|
||||
from gluon._compat import urllib2, PY2
|
||||
|
||||
webserverprocess = None
|
||||
|
||||
@@ -110,6 +110,7 @@ class TestWeb(LiveTest):
|
||||
assert('expires' in s.headers)
|
||||
assert(s.headers['cache-control'].startswith('max-age'))
|
||||
|
||||
@unittest.skipIf(not(PY2), 'skip PY3 testSoap')
|
||||
def testSoap(self):
|
||||
# test soap server implementation
|
||||
from gluon.contrib.pysimplesoap.client import SoapClient, SoapFault
|
||||
|
||||
Reference in New Issue
Block a user