From 1a7489354b615671703dca25e8bc5823c78bf9f0 Mon Sep 17 00:00:00 2001
From: Andrew Svetlov <andrew.svetlov@gmail.com>
Date: Wed, 29 Jul 2015 23:58:55 +0300
Subject: [PATCH] Fix tests

---
 aiohttp_security/cookies_identity.py |  3 ++-
 tests/test_cookies_identity.py       | 12 ++++--------
 tests/test_dict_autz.py              |  6 ++----
 3 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/aiohttp_security/cookies_identity.py b/aiohttp_security/cookies_identity.py
index de1620f..0df9f83 100644
--- a/aiohttp_security/cookies_identity.py
+++ b/aiohttp_security/cookies_identity.py
@@ -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):
diff --git a/tests/test_cookies_identity.py b/tests/test_cookies_identity.py
index e72c052..e96fbac 100644
--- a/tests/test_cookies_identity.py
+++ b/tests/test_cookies_identity.py
@@ -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
diff --git a/tests/test_dict_autz.py b/tests/test_dict_autz.py
index f37cacc..72e861a 100644
--- a/tests/test_dict_autz.py
+++ b/tests/test_dict_autz.py
@@ -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