Skip to content

Commit

Permalink
test session+redirect. webpy#36
Browse files Browse the repository at this point in the history
  • Loading branch information
anandology committed May 3, 2011
1 parent b1417f5 commit a82374e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ class reset(app.page):
def GET(self):
session.kill()
return ""

class redirect(app.page):
def GET(self):
session.request_token = '123'
raise web.redirect('/count')

class get_session(app.page):
path = "/session/(.*)"
def GET(self, name):
return session[name]

self.app = app
self.session = session
Expand Down Expand Up @@ -51,6 +61,12 @@ def testBadSessionId(self):
cookie.value = '/etc/password'
self.assertEquals(b.open('/count').read(), '1')

def testRedirect(self):
b = self.app.browser()
b.open("/redirect")
b.open("/session/request_token")
assert b.data == '123'

class DBSessionTest(SessionTest):
"""Session test with db store."""
def make_session(self, app):
Expand Down

0 comments on commit a82374e

Please sign in to comment.