summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_swiftclient.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/test_swiftclient.py b/tests/test_swiftclient.py
index 8bc8861..5fd1e28 100644
--- a/tests/test_swiftclient.py
+++ b/tests/test_swiftclient.py
@@ -121,12 +121,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
@@ -430,6 +433,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):
@@ -496,6 +505,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):
@@ -543,6 +558,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):