fix(test): decode response chunks in mock
This commit is contained in:
parent
b8da77b2d5
commit
e6e959bad3
16
Makefile
16
Makefile
|
@ -36,12 +36,18 @@ clean-coverage:
|
|||
clean-package:
|
||||
rm -rf dist
|
||||
|
||||
test: test-unit
|
||||
test: test-unit-3
|
||||
|
||||
test-unit:
|
||||
coverage run -m unittest discover -s tests/
|
||||
coverage html
|
||||
coverage xml
|
||||
test-unit-2:
|
||||
PYCMD=python2 $(MAKE) test-unit-N
|
||||
|
||||
test-unit-3:
|
||||
PYCMD=python3 $(MAKE) test-unit-N
|
||||
|
||||
test-unit-N:
|
||||
${PYCMD} -m coverage run -m unittest discover -s tests/
|
||||
${PYCMD} -m coverage html
|
||||
${PYCMD} -m coverage xml
|
||||
|
||||
package: clean-package package-dist package-upload
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ class MockConnection(object):
|
|||
print('recv', n)
|
||||
self.buffer = self.body[self.index : self.index + n]
|
||||
self.index += n
|
||||
return self.buffer.encode('utf-8')
|
||||
return self.buffer.encode(ps.http_encoding)
|
||||
|
||||
def send(self, chunk):
|
||||
self.accum.append(chunk)
|
||||
|
@ -23,7 +23,7 @@ class MockConnection(object):
|
|||
self.open = False
|
||||
|
||||
def response(self):
|
||||
return ''.join(self.accum)
|
||||
return ''.join([x.decode(ps.http_encoding) for x in self.accum])
|
||||
|
||||
class MockSocket(object):
|
||||
def __init__(self, addr, body):
|
||||
|
|
Loading…
Reference in New Issue