Correctly initialize TestResponses

There's a pretty awful hack currently in place to add the reason
attribute to the TestResponse class.  This code correctly initializes
the class, including the reason attribute.

Change-Id: I73384db1f89add051547f4d5db36ab1e647e84ef
Closes-Bug: 1613740
(cherry picked from commit 2c859f1d6d)
This commit is contained in:
woodnt 2016-09-08 14:14:28 -06:00 committed by Rob Cresswell
parent 39148145e2
commit 83a7c97271
1 changed files with 1 additions and 1 deletions

View File

@ -37,7 +37,7 @@ class TestResponse(requests.Response):
def __init__(self, data):
self._text = None
super(TestResponse, self)
super(TestResponse, self).__init__()
if isinstance(data, dict):
self.status_code = data.get('status_code', 200)
self.headers = data.get('headers', None)