summaryrefslogtreecommitdiffstats
path: root/test/functional/swift_test_client.py
diff options
context:
space:
mode:
authorLuis Pabon <lpabon@redhat.com>2014-01-10 19:44:39 -0500
committerLuis Pabon <lpabon@redhat.com>2014-01-15 11:28:08 -0800
commit6a8e9a70e9489a8f17405adf64462899d6a4ca81 (patch)
treecb5f30493b3a3a623ec1de2504d4ce9c48ded3ec /test/functional/swift_test_client.py
parent62d07833db5412f482001b275d2d646abbf21c14 (diff)
Sync with OpenStack v1.11.0 Jan 10 2014v1.11.0
Updated tox.ini, functional tests, and proxy unit tests. BUG: https://bugs.launchpad.net/bugs/1268017 Change-Id: I5ff8359b8abdb8fe5ae82492c12f57c395992735 Signed-off-by: Luis Pabon <lpabon@redhat.com> Reviewed-on: http://review.gluster.org/6682 Reviewed-by: Thiago da Silva <thiago@redhat.com> Tested-by: Thiago da Silva <thiago@redhat.com>
Diffstat (limited to 'test/functional/swift_test_client.py')
-rw-r--r--test/functional/swift_test_client.py23
1 files changed, 20 insertions, 3 deletions
diff --git a/test/functional/swift_test_client.py b/test/functional/swift_test_client.py
index d407a33..47e023e 100644
--- a/test/functional/swift_test_client.py
+++ b/test/functional/swift_test_client.py
@@ -65,7 +65,7 @@ class ResponseError(Exception):
def listing_empty(method):
- for i in xrange(0, 6):
+ for i in xrange(6):
if len(method()) == 0:
return True
@@ -208,7 +208,11 @@ class Connection(object):
def make_request(self, method, path=[], data='', hdrs={}, parms={},
cfg={}):
- path = self.make_path(path, cfg=cfg)
+ if not cfg.get('verbatim_path'):
+ # Set verbatim_path=True to make a request to exactly the given
+ # path, not storage path + given path. Useful for
+ # non-account/container/object requests.
+ path = self.make_path(path, cfg=cfg)
headers = self.make_headers(hdrs, cfg=cfg)
if isinstance(parms, dict) and parms:
quote = urllib.quote
@@ -719,7 +723,8 @@ class File(Base):
else:
raise RuntimeError
- def write(self, data='', hdrs={}, parms={}, callback=None, cfg={}):
+ def write(self, data='', hdrs={}, parms={}, callback=None, cfg={},
+ return_resp=False):
block_size = 2 ** 20
if isinstance(data, file):
@@ -763,6 +768,9 @@ class File(Base):
pass
self.md5 = self.compute_md5sum(data)
+ if return_resp:
+ return self.conn.response
+
return True
def write_random(self, size=None, hdrs={}, parms={}, cfg={}):
@@ -772,3 +780,12 @@ class File(Base):
self.conn.make_path(self.path))
self.md5 = self.compute_md5sum(StringIO.StringIO(data))
return data
+
+ def write_random_return_resp(self, size=None, hdrs={}, parms={}, cfg={}):
+ data = self.random_data(size)
+ resp = self.write(data, hdrs=hdrs, parms=parms, cfg=cfg,
+ return_resp=True)
+ if not resp:
+ raise ResponseError(self.conn.response)
+ self.md5 = self.compute_md5sum(StringIO.StringIO(data))
+ return resp