diff options
author | Alistair Coles <alistair.coles@hpe.com> | 2016-01-05 18:25:19 +0000 |
---|---|---|
committer | Alistair Coles <alistair.coles@hpe.com> | 2016-01-05 18:25:19 +0000 |
commit | ab3460905084aeb0961ad8e1ca280ff6d6b6c9dd (patch) | |
tree | 128d12105aa1ae681b40a061b553ff9e722df181 /tests/functional/test_swiftclient.py | |
parent | 39b1a31d8a187534f54e32e9aec2cb2bb839a390 (diff) | |
download | python-swiftclient-ab3460905084aeb0961ad8e1ca280ff6d6b6c9dd.tar.gz |
Add functional test for object PUT with raw iterator
Adds a functional test to verify change made in [1]
[1] change id I19579ed7a0181ac3f488433e7c1839f7f7a040b8
Change-Id: I45dbf66edab645e6339e67906aee5faa4fb7efbd
Diffstat (limited to 'tests/functional/test_swiftclient.py')
-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() |