Small Fix for FakeServerConnection

Current FakeServerConnection might cause 499 error
in some unit tests because sent (put) data will be
overridden by new one every time.
e.g. When calling conn.queue.put() twice and more in
an object PUT sequence, we can use only a last chunk as
the body. This fixes it to merge all chunks as a body.

Change-Id: I463e9e2b454e3f3eb26950b3af4c8b8167a9a971
This commit is contained in:
Kota Tsuyuzaki 2014-08-28 19:20:02 -07:00
parent 8d02147d04
commit 3a7f80aa47

View File

@ -51,6 +51,7 @@ class FakeServerConnection(WSGIContext):
environ = {'REQUEST_METHOD': self.method}
req = Request.blank(self.path, environ, headers=self.req_headers,
body=self.data)
self.data = ''
self.resp = self._app_call(req.environ)
self.resp_iter = iter(self.resp)
if self._response_headers is None:
@ -66,7 +67,7 @@ class FakeServerConnection(WSGIContext):
return ContinueResponse()
def send(self, data):
self.data = data
self.data += data
def __call__(self, ipaddr, port, device, partition, method, path,
headers=None, query_string=None):