diff options
-rw-r--r-- | tests/functional/test_swiftclient.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/functional/test_swiftclient.py b/tests/functional/test_swiftclient.py index 35a5ea7..ef1b9d5 100644 --- a/tests/functional/test_swiftclient.py +++ b/tests/functional/test_swiftclient.py @@ -318,6 +318,21 @@ class TestFunctional(testtools.TestCase): downloaded_contents += body.read() self.assertEqual(self.test_data, downloaded_contents) + def test_put_object_using_generator(self): + # verify that put using a generator yielding empty strings does not + # cause connection to be closed + def data(): + yield "should" + yield "" + yield " tolerate" + yield "" + yield " empty chunks" + + self.conn.put_object( + self.containername, self.objectname, data()) + hdrs, body = self.conn.get_object(self.containername, self.objectname) + self.assertEqual("should tolerate empty chunks", body) + def test_post_account(self): self.conn.post_account({'x-account-meta-data': 'Something'}) headers = self.conn.head_account() |