Mercurial > p > roundup > code
comparison roundup/web/router.py @ 4918:35dc9191394d routing
routing: Use Router in cgi.client.main
| author | anatoly techtonik <techtonik@gmail.com> |
|---|---|
| date | Tue, 12 Aug 2014 00:36:15 +0300 |
| parents | e5f90a69f660 |
| children | 6ee1844019d5 |
comparison
equal
deleted
inserted
replaced
| 4917:2502a9dde1ac | 4918:35dc9191394d |
|---|---|
| 21 | 21 |
| 22 ExampleHandler = NamedObject('ExampleHandler') | 22 ExampleHandler = NamedObject('ExampleHandler') |
| 23 ExampleFileHandler = NamedObject('ExampleFileHandler') | 23 ExampleFileHandler = NamedObject('ExampleFileHandler') |
| 24 | 24 |
| 25 | 25 |
| 26 EXAMPLE_URLMAP = ( | 26 EXAMPLE_URL_MAP = ( |
| 27 'static/(.*)', ExampleFileHandler, | 27 'static/(.*)', ExampleFileHandler, |
| 28 'index', ExampleHandler | 28 'index', ExampleHandler |
| 29 ) | 29 ) |
| 30 | 30 |
| 31 | 31 |
| 64 if __name__ == '__main__': | 64 if __name__ == '__main__': |
| 65 | 65 |
| 66 import unittest | 66 import unittest |
| 67 class test_Router(unittest.TestCase): | 67 class test_Router(unittest.TestCase): |
| 68 def test_example_routes(self): | 68 def test_example_routes(self): |
| 69 router = Router(EXAMPLE_URLMAP) | 69 router = Router(EXAMPLE_URL_MAP) |
| 70 self.assertEquals(router.get_handler(''), (None, ())) | 70 self.assertEquals(router.get_handler(''), (None, ())) |
| 71 handler, params = router.get_handler('/index') | 71 handler, params = router.get_handler('/index') |
| 72 self.assertEquals(handler, ExampleHandler) | 72 self.assertEquals(handler, ExampleHandler) |
| 73 self.assertEquals(params, tuple()) | 73 self.assertEquals(params, tuple()) |
| 74 | 74 |
