TestResponse: use a default status code

The status_code field is compared to integers in the requests library, so it
has to be set to an integer, not to None. This works in Python 2 because back
then, one could compare an int to NoneType.

Partial-Bug: 1287323
Change-Id: I7138ceca36692fdf5948c4d6f74186f89c2709f0
This commit is contained in:
Cyril Roelandt 2014-03-03 16:30:14 +01:00
parent dd98eca42f
commit f6221a11e3
1 changed files with 1 additions and 1 deletions

View File

@ -39,7 +39,7 @@ class TestResponse(requests.Response):
self._text = None
super(TestResponse, self)
if isinstance(data, dict):
self.status_code = data.get('status_code', None)
self.status_code = data.get('status_code', 200)
self.headers = data.get('headers', None)
# Fake the text attribute to streamline Response creation
self._text = data.get('text', None)