web/test/unittest_views_apacherewrite.py
changeset 8695 358d8bed9626
parent 6340 470d8e828fda
equal deleted inserted replaced
8694:d901c36bcfce 8695:358d8bed9626
    38         urlrewriter = MyAppRules()
    38         urlrewriter = MyAppRules()
    39         req = None # not used in the above rules, so keep a simple TestCase here
    39         req = None # not used in the above rules, so keep a simple TestCase here
    40         try:
    40         try:
    41             urlrewriter.rewrite('logilab.fr', '/whatever', req)
    41             urlrewriter.rewrite('logilab.fr', '/whatever', req)
    42             self.fail('redirect exception expected')
    42             self.fail('redirect exception expected')
    43         except Redirect, ex:
    43         except Redirect as ex:
    44             self.assertEqual(ex.location, 'http://www.logilab.fr/whatever')
    44             self.assertEqual(ex.location, 'http://www.logilab.fr/whatever')
    45         self.assertEqual(urlrewriter.rewrite('www.logilab.fr', '/whatever', req),
    45         self.assertEqual(urlrewriter.rewrite('www.logilab.fr', '/whatever', req),
    46                           '/whatever')
    46                           '/whatever')
    47         self.assertEqual(urlrewriter.rewrite('www.logilab.fr', '/json/bla', req),
    47         self.assertEqual(urlrewriter.rewrite('www.logilab.fr', '/json/bla', req),
    48                           '/json/bla')
    48                           '/json/bla')