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