Fix tests

This commit is contained in:
Andrew Svetlov 2015-07-29 23:58:55 +03:00
parent 76574b12b0
commit 1a7489354b
3 changed files with 8 additions and 13 deletions

View File

@ -22,7 +22,8 @@ class CookiesIdentityPolicy(AbstractIdentityPolicy):
**kwargs): **kwargs):
if max_age is sentinel: if max_age is sentinel:
max_age = self._max_age max_age = self._max_age
response.set_cookie(self._cookie_name, max_age=max_age, **kwargs) response.set_cookie(self._cookie_name, identity,
max_age=max_age, **kwargs)
@asyncio.coroutine @asyncio.coroutine
def forget(self, request, response): def forget(self, request, response):

View File

@ -61,8 +61,7 @@ class TestCookiesIdentity(unittest.TestCase):
@asyncio.coroutine @asyncio.coroutine
def handler(request): def handler(request):
response = web.Response() response = web.Response()
hdrs = yield from remember(request, 'Andrew') yield from remember(request, response, 'Andrew')
response.headers.extend(hdrs)
return response return response
@asyncio.coroutine @asyncio.coroutine
@ -82,8 +81,7 @@ class TestCookiesIdentity(unittest.TestCase):
@asyncio.coroutine @asyncio.coroutine
def create(request): def create(request):
response = web.Response() response = web.Response()
hdrs = yield from remember(request, 'Andrew') yield from remember(request, response, 'Andrew')
response.headers.extend(hdrs)
return response return response
@asyncio.coroutine @asyncio.coroutine
@ -116,15 +114,13 @@ class TestCookiesIdentity(unittest.TestCase):
@asyncio.coroutine @asyncio.coroutine
def login(request): def login(request):
response = web.HTTPFound(location='/') response = web.HTTPFound(location='/')
hdrs = yield from remember(request, 'Andrew') yield from remember(request, response, 'Andrew')
response.headers.extend(hdrs)
return response return response
@asyncio.coroutine @asyncio.coroutine
def logout(request): def logout(request):
response = web.HTTPFound(location='/') response = web.HTTPFound(location='/')
hdrs = yield from forget(request) yield from forget(request, response)
response.headers.extend(hdrs)
return response return response
@asyncio.coroutine @asyncio.coroutine

View File

@ -67,8 +67,7 @@ class TestCookiesIdentity(unittest.TestCase):
@asyncio.coroutine @asyncio.coroutine
def login(request): def login(request):
response = web.HTTPFound(location='/') response = web.HTTPFound(location='/')
hdrs = yield from remember(request, 'UserID') yield from remember(request, response, 'UserID')
response.headers.extend(hdrs)
return response return response
@asyncio.coroutine @asyncio.coroutine
@ -113,8 +112,7 @@ class TestCookiesIdentity(unittest.TestCase):
@asyncio.coroutine @asyncio.coroutine
def login(request): def login(request):
response = web.HTTPFound(location='/') response = web.HTTPFound(location='/')
hdrs = yield from remember(request, 'UserID') yield from remember(request, response, 'UserID')
response.headers.extend(hdrs)
return response return response
@asyncio.coroutine @asyncio.coroutine