42
42
self.assertEqual({'controller': 'content', 'action': 'index', 'hoge': hoge},
43
43
m.match('/' + hoge_enc))
45
def test_disabling_unicode(self):
46
hoge = u'\u30c6\u30b9\u30c8' # the word test in Japanese
47
hoge_enc = urllib.quote_plus(hoge.encode('utf-8'))
51
self.assertEqual({'controller': 'content', 'action': 'index', 'hoge': hoge_enc},
52
m.match('/' + hoge_enc))
45
54
def test_basic_dynamic(self):
46
55
for path in ['hi/:name', 'hi/:(name)']:
448
457
self.assertEqual({'controller':'content','action':'index', 'id': 'None'}, m.match('/content/index/None.py'))
449
458
self.assertEqual({'controller':'content','action':'list', 'id':'None'}, m.match('/content/list/None.py'))
450
459
self.assertEqual({'controller':'content','action':'show','id':'10'}, m.match('/content/show/10.py'))
461
def test_standard_route_with_gaps_and_domains(self):
463
m.connect('manage/:domain.:ext', controller='admin/user', action='view', ext='html')
464
m.connect(':controller/:action/:id')
465
m.create_regs(['content','admin/user'])
467
self.assertEqual({'controller':'content','action':'index', 'id': 'None.py'}, m.match('/content/index/None.py'))
468
self.assertEqual({'controller':'content','action':'list', 'id':'None.py'}, m.match('/content/list/None.py'))
469
self.assertEqual({'controller':'content','action':'show','id':'10.py'}, m.match('/content/show/10.py'))
470
self.assertEqual({'controller':'content','action':'show.all','id':'10.py'}, m.match('/content/show.all/10.py'))
471
self.assertEqual({'controller':'content','action':'show','id':'www.groovie.org'}, m.match('/content/show/www.groovie.org'))
473
self.assertEqual({'controller':'admin/user','action':'view', 'ext': 'html', 'domain': 'groovie'}, m.match('/manage/groovie'))
474
self.assertEqual({'controller':'admin/user','action':'view', 'ext': 'xml', 'domain': 'groovie'}, m.match('/manage/groovie.xml'))
476
def test_standard_with_domains(self):
478
m.connect('manage/:domain', controller='domains', action='view')
479
m.create_regs(['domains'])
481
self.assertEqual({'controller':'domains','action':'view','domain':'www.groovie.org'}, m.match('/manage/www.groovie.org'))
452
483
def test_default_route(self):