From 6a8e9a70e9489a8f17405adf64462899d6a4ca81 Mon Sep 17 00:00:00 2001 From: Luis Pabon Date: Fri, 10 Jan 2014 19:44:39 -0500 Subject: Sync with OpenStack v1.11.0 Jan 10 2014 Updated tox.ini, functional tests, and proxy unit tests. BUG: https://bugs.launchpad.net/bugs/1268017 Change-Id: I5ff8359b8abdb8fe5ae82492c12f57c395992735 Signed-off-by: Luis Pabon Reviewed-on: http://review.gluster.org/6682 Reviewed-by: Thiago da Silva Tested-by: Thiago da Silva --- test/functional/swift_test_client.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'test/functional/swift_test_client.py') 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 -- cgit