summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDavid Goetz <dpgoetz@gmail.com>2013-03-05 15:12:04 -0800
committerDavid Goetz <dpgoetz@gmail.com>2013-04-03 09:51:15 -0700
commit2b3d1719073fa58b651ca82f64a366e3f737d71a (patch)
tree7c411eade321bbdc2f0c02b90e20064e87e8f245 /tests
parent4f57f815b3847c9f4a2edc20784a770b806f4045 (diff)
downloadpython-swiftclient-2b3d1719073fa58b651ca82f64a366e3f737d71a.tar.gz
Static large object support.
Also fixed bug with current large objects with segment listing prefixes. Allow retry for object PUTs when possible. Change-Id: I0edff127fd5d5c53da33aa7cb76a4f4dc85bf6e6
Diffstat (limited to 'tests')
-rw-r--r--tests/test_swiftclient.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/tests/test_swiftclient.py b/tests/test_swiftclient.py
index 8e4289e..3a22515 100644
--- a/tests/test_swiftclient.py
+++ b/tests/test_swiftclient.py
@@ -123,12 +123,15 @@ class MockHttpTest(testtools.TestCase):
def fake_http_connection(*args, **kwargs):
_orig_http_connection = c.http_connection
return_read = kwargs.get('return_read')
+ query_string = kwargs.get('query_string')
def wrapper(url, proxy=None):
parsed, _conn = _orig_http_connection(url, proxy=proxy)
conn = fake_http_connect(*args, **kwargs)()
- def request(*args, **kwargs):
+ def request(method, url, *args, **kwargs):
+ if query_string:
+ self.assert_(url.endswith('?' + query_string))
return
conn.request = request
@@ -436,6 +439,12 @@ class TestGetObject(MockHttpTest):
self.assertRaises(c.ClientException, c.get_object,
'http://www.test.com', 'asdf', 'asdf', 'asdf')
+ def test_query_string(self):
+ c.http_connection = self.fake_http_connection(200,
+ query_string="hello=20")
+ c.get_object('http://www.test.com', 'asdf', 'asdf', 'asdf',
+ query_string="hello=20")
+
class TestHeadObject(MockHttpTest):
@@ -492,7 +501,6 @@ class TestPutObject(MockHttpTest):
self.assertEquals(len(w), 1)
self.assertTrue(issubclass(w[-1].category, UserWarning))
-
def test_server_error(self):
body = 'c' * 60
c.http_connection = self.fake_http_connection(500, body=body)
@@ -503,6 +511,12 @@ class TestPutObject(MockHttpTest):
except c.ClientException as e:
self.assertEquals(e.http_response_content, body)
+ def test_query_string(self):
+ c.http_connection = self.fake_http_connection(200,
+ query_string="hello=20")
+ c.put_object('http://www.test.com', 'asdf', 'asdf', 'asdf',
+ query_string="hello=20")
+
class TestPostObject(MockHttpTest):
@@ -550,6 +564,12 @@ class TestDeleteObject(MockHttpTest):
self.assertRaises(c.ClientException, c.delete_object,
'http://www.test.com', 'asdf', 'asdf', 'asdf')
+ def test_query_string(self):
+ c.http_connection = self.fake_http_connection(200,
+ query_string="hello=20")
+ c.delete_object('http://www.test.com', 'asdf', 'asdf', 'asdf',
+ query_string="hello=20")
+
class TestConnection(MockHttpTest):