X Tutup
Skip to content

Commit bfd650f

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Fix unit tests broken by requests-mock >= 1.12.0"
2 parents 61e4150 + 300b8c8 commit bfd650f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

glanceclient/tests/utils.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# under the License.
1515

1616
import copy
17+
from email.message import EmailMessage
1718
import io
1819
import json
1920
import testtools
@@ -112,7 +113,12 @@ def __init__(self, headers=None, body=None,
112113
self.body = body
113114
self.reason = reason
114115
self.version = version
115-
self.headers = headers
116+
# NOTE(tkajinam): Make the FakeResponse class compatible with
117+
# http.client.HTTPResponse
118+
# https://docs.python.org/3/library/http.client.html
119+
self.headers = EmailMessage()
120+
for header_key in headers:
121+
self.headers[header_key] = headers[header_key]
116122
self.headers['x-openstack-request-id'] = 'req-1234'
117123
self.status_code = status_code
118124
self.raw = RawRequest(headers, body=body, reason=reason,

0 commit comments

Comments
 (0)
X Tutup