Example #1
0
    def test_url_for(self):
        class DummyHandler(RequestHandler):
            def get(self, **kwargs):
                return ''

        rules = [
            NamePrefix('company-', [
                Rule('/', name='home', handler=DummyHandler),
                Rule('/about', name='about', handler=DummyHandler),
                Rule('/contact', name='contact', handler=DummyHandler),
            ]),
        ]

        app = Tipfy(rules)

        with app.get_test_handler('/') as handler:
            self.assertEqual(url_for('company-home'), '/')
            self.assertEqual(url_for('company-about'), '/about')
            self.assertEqual(url_for('company-contact'), '/contact')
Example #2
0
    def test_url_for(self):
        class DummyHandler(RequestHandler):
            def get(self, **kwargs):
                return ''

        rules = [
            NamePrefix('company-', [
                Rule('/', name='home', handler=DummyHandler),
                Rule('/about', name='about', handler=DummyHandler),
                Rule('/contact', name='contact', handler=DummyHandler),
            ]),
        ]

        app = Tipfy(rules)

        with app.get_test_handler('/') as handler:
            self.assertEqual(url_for('company-home'), '/')
            self.assertEqual(url_for('company-about'), '/about')
            self.assertEqual(url_for('company-contact'), '/contact')
Example #3
0
 def confirm_url(self):
     if self.is_temp: return None
     return url_for('confirm', self.id, self.confirmation_token)
Example #4
0
 def confirm_url(self):
     if self.is_temp: return None
     return url_for('confirm', self.id, self.confirmation_token)