Skip to content

Commit

Permalink
Fix test suite for aiohttp>=0.22
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Feb 21, 2016
1 parent 009db41 commit d5842c4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/test_get_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import unittest
from unittest import mock

import aiohttp
from aiohttp.web import Request, HttpVersion
from aiohttp import CIMultiDict, RawRequestMessage

Expand All @@ -22,8 +23,14 @@ def tearDown(self):
def make_request(self, method, path, headers=CIMultiDict(), *,
version=HttpVersion(1, 1), closing=False):
self.app = mock.Mock()
message = RawRequestMessage(method, path, version, headers, closing,
False)
if tuple(int(i) for i in aiohttp.__version__.split('.')) < (0, 21):
message = RawRequestMessage(method, path, version, headers,
closing, False)
else:
message = RawRequestMessage(method, path, version, headers,
[(k.encode('utf-8'), v.encode('utf-8'))
for k, v in headers.items()],
closing, False)
self.payload = mock.Mock()
self.transport = mock.Mock()
self.writer = mock.Mock()
Expand Down

0 comments on commit d5842c4

Please sign in to comment.