Python 3: the content of a FakeResponse must be bytes
Encode '_content' if necessary. Change-Id: I25c1e1cd5330f0519bf062be840045d0ef520b28
This commit is contained in:
@@ -19,6 +19,7 @@ import json
|
||||
import mock
|
||||
|
||||
import requests
|
||||
import six
|
||||
|
||||
from openstackclient.common import restapi
|
||||
from openstackclient.tests import utils
|
||||
@@ -62,6 +63,8 @@ class FakeResponse(requests.Response):
|
||||
|
||||
self.headers.update(headers)
|
||||
self._content = json.dumps(data)
|
||||
if not isinstance(self._content, six.binary_type):
|
||||
self._content = self._content.encode()
|
||||
|
||||
|
||||
@mock.patch('openstackclient.common.restapi.requests.Session')
|
||||
|
Reference in New Issue
Block a user