fix rewrite, enabled test_router & test_routes
This commit is contained in:
+2
-2
@@ -27,7 +27,7 @@ from gluon.storage import Storage, List
|
||||
from gluon.http import HTTP
|
||||
from gluon.fileutils import abspath, read_file
|
||||
from gluon.settings import global_settings
|
||||
from gluon._compat import urllib_unquote, urllib_quote, iteritems
|
||||
from gluon._compat import urllib_unquote, urllib_quote, iteritems, xrange
|
||||
|
||||
isdir = os.path.isdir
|
||||
isfile = os.path.isfile
|
||||
@@ -317,7 +317,7 @@ def load(routes='routes.py', app=None, data=None, rdict=None):
|
||||
|
||||
symbols = dict(app=app)
|
||||
try:
|
||||
exec (data + '\n') in symbols
|
||||
exec(data + '\n', symbols)
|
||||
except SyntaxError as e:
|
||||
logger.error(
|
||||
'%s has a syntax error and will not be loaded\n' % path
|
||||
|
||||
@@ -11,13 +11,13 @@ from .test_cache import *
|
||||
from .test_template import *
|
||||
from .test_html import *
|
||||
from .test_contribs import *
|
||||
from .test_routes import *
|
||||
from .test_router import *
|
||||
|
||||
if sys.version[:3] == '2.7':
|
||||
from .test_compileapp import *
|
||||
from .test_is_url import *
|
||||
from .test_languages import *
|
||||
from .test_router import *
|
||||
from .test_routes import *
|
||||
from .test_serializers import *
|
||||
from .test_validators import *
|
||||
from .test_utils import *
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""Unit tests for rewrite.py routers option"""
|
||||
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
import os
|
||||
import unittest
|
||||
@@ -21,6 +21,7 @@ from gluon.fileutils import abspath
|
||||
from gluon.settings import global_settings
|
||||
from gluon.http import HTTP
|
||||
from gluon.storage import Storage
|
||||
from gluon._compat import to_bytes, to_native
|
||||
|
||||
logger = None
|
||||
oldcwd = None
|
||||
@@ -1366,8 +1367,9 @@ class TestRouter(unittest.TestCase):
|
||||
URL(a='init', c='default', f='f', args=['ar g'])), "/f/ar%20g")
|
||||
self.assertEqual(str(
|
||||
URL(a='init', c='default', f='f', args=['årg'])), "/f/%C3%A5rg")
|
||||
self.assertEqual(URL(a='init', c='default', f='fünc'), "/fünc")
|
||||
self.assertEqual(
|
||||
str(URL(a='init', c='default', f='fünc')), "/f\xc3\xbcnc")
|
||||
to_bytes(URL(a='init', c='default', f='fünc')), b"/f\xc3\xbcnc")
|
||||
|
||||
def test_routes_anchor(self):
|
||||
'''
|
||||
|
||||
@@ -21,6 +21,7 @@ from gluon.fileutils import abspath
|
||||
from gluon.settings import global_settings
|
||||
from gluon.http import HTTP
|
||||
from gluon.storage import Storage
|
||||
from gluon._compat import to_bytes
|
||||
|
||||
logger = None
|
||||
oldcwd = None
|
||||
@@ -319,7 +320,9 @@ routes_out = [
|
||||
self.assertEqual(str(URL(
|
||||
a='welcome', c='default', f='f', args=['årg'])), "/f/%C3%A5rg")
|
||||
self.assertEqual(
|
||||
str(URL(a='welcome', c='default', f='fünc')), "/f\xc3\xbcnc")
|
||||
URL(a='welcome', c='default', f='fünc'), "/fünc")
|
||||
self.assertEqual(
|
||||
to_bytes(URL(a='welcome', c='default', f='fünc')), b"/f\xc3\xbcnc")
|
||||
|
||||
def test_routes_anchor(self):
|
||||
'''
|
||||
|
||||
@@ -11,8 +11,6 @@ import datetime
|
||||
import sys
|
||||
|
||||
from .fix_path import fix_sys_path
|
||||
|
||||
|
||||
fix_sys_path(__file__)
|
||||
|
||||
from gluon.storage import Storage
|
||||
@@ -25,7 +23,7 @@ class BaseTestScheduler(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.db = None
|
||||
self.cleanfolder()
|
||||
from gluon import current
|
||||
from gluon.globals import current
|
||||
s = Storage({'application': 'welcome',
|
||||
'folder': 'applications/welcome',
|
||||
'controller': 'default'})
|
||||
|
||||
Reference in New Issue
Block a user