add ok flag to the MockResponse object in order to be compatible with the AWS code, which examines this flag in a callback.

This commit is contained in:
Oleksii Kliukin
2015-06-05 08:59:32 +02:00
parent 1ae19f758b
commit e2de4c9045
+4
View File
@@ -12,6 +12,7 @@ class MockResponse:
def __init__(self):
self.status_code = 200
self.content = '{}'
self.ok = True
def json(self):
return json.loads(self.content)
@@ -34,6 +35,9 @@ def requests_get(url, **kwargs):
response.status_code = 404
elif url.startswith('http://noleader'):
response.content = '{"action":"get","node":{"key":"/service/batman5","dir":true,"nodes":[{"key":"/service/batman5/initialize","value":"postgresql0","modifiedIndex":1582,"createdIndex":1582},{"key":"/service/batman5/leader","value":"postgresql1","expiration":"2015-05-15T09:11:00.037397538Z","ttl":21,"modifiedIndex":20728,"createdIndex":20434},{"key":"/service/batman5/optime","dir":true,"nodes":[{"key":"/service/batman5/optime/leader","value":"2164261704","modifiedIndex":20729,"createdIndex":20729}],"modifiedIndex":20437,"createdIndex":20437},{"key":"/service/batman5/members","dir":true,"nodes":[{"key":"/service/batman5/members/postgresql0","value":"postgres://replicator:[email protected]:5433/postgres","expiration":"2015-05-15T09:11:09.611860899Z","ttl":30,"modifiedIndex":20730,"createdIndex":20730}],"modifiedIndex":1581,"createdIndex":1581}],"modifiedIndex":1581,"createdIndex":1581}}'
else:
response.status_code = 404
response.ok = False
return response