Skip to content

Commit

Permalink
Added test_removeslash.
Browse files Browse the repository at this point in the history
  • Loading branch information
leekchan committed Sep 14, 2014
1 parent b477d30 commit 2fd42e8
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tornado/test/web_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2357,3 +2357,29 @@ def test_finish_exception(self):
self.assertEqual('Basic realm="something"',
response.headers.get('WWW-Authenticate'))
self.assertEqual(b'authentication required', response.body)


from tornado.web import removeslash, addslash
class DecoratorTest(WebTestCase):
def get_handlers(self):
class RemoveSlashHandler(RequestHandler):
@removeslash
def get(self):
pass

class AddSlashHandler(RequestHandler):
@addslash
def get(self):
pass

return [("/removeslash", RemoveSlashHandler),
("/addslash", AddSlashHandler),
]

def test_removeslash(self):
self.http_client.fetch(self.get_url('/removeslash/'), self.stop,
follow_redirects=False)
response = self.wait()
self.assertEqual(response.code, 302)
self.assertEqual(response.headers['Location'], '/removeslash')

0 comments on commit 2fd42e8

Please sign in to comment.