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):
if max_age is sentinel:
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
def forget(self, request, response):

View File

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

View File

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