fix mock and assert in test_direct_client

Change-Id: Ia6c14377e5dd768a5306a2448f0bf244ebc3634e
This commit is contained in:
Clay Gerrard 2015-12-07 10:19:51 -08:00
parent b3d6fa1319
commit 62b9a0eeea

View File

@ -70,10 +70,10 @@ class FakeConn(object):
return self.resp_headers.items()
def read(self, amt=None):
if amt is None:
return self.body
elif isinstance(self.body, six.StringIO):
if isinstance(self.body, six.StringIO):
return self.body.read(amt)
elif amt is None:
return self.body
else:
return Exception('Not a StringIO entry')
@ -508,7 +508,7 @@ class TestDirectClient(unittest.TestCase):
self.node, self.part, self.account, self.container, self.obj)
self.assertEqual(conn.method, 'GET')
self.assertEqual(conn.path, self.obj_path)
self.assertEqual(obj_body, contents)
self.assertEqual(obj_body, contents.getvalue())
def test_direct_get_object_error(self):
with mocked_http_conn(500) as conn: