summaryrefslogtreecommitdiff
path: root/tests/unit/utils.py
diff options
context:
space:
mode:
authorAlistair Coles <alistair.coles@hp.com>2014-10-15 18:56:58 +0100
committerAlistair Coles <alistair.coles@hp.com>2014-10-20 12:00:54 +0100
commit871a3e40f306f1bff056a86edcd644a82ab29c67 (patch)
treea7d9310bb000db7e24a11abffbdc14625b93f5ac /tests/unit/utils.py
parentbbe3378ebbdfd5b5aeae979965fa2ac9e165afb4 (diff)
downloadpython-swiftclient-871a3e40f306f1bff056a86edcd644a82ab29c67.tar.gz
Fix KeyError raised from client Connection
Some client.Connection methods will raise a KeyError if a response_dict argument is passed and an error occurs during authentication or making the request. The fix is straightforward: add a test for existence of a response_dict before attempting to get it from kwargs. The bulk of this patch is adding unit tests for the response_dict feature. Closes-Bug: 1381304 Change-Id: Ic7e1b3dfae33909533931c52ac97355867a08a07
Diffstat (limited to 'tests/unit/utils.py')
-rw-r--r--tests/unit/utils.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/unit/utils.py b/tests/unit/utils.py
index 09b31c1..c149abf 100644
--- a/tests/unit/utils.py
+++ b/tests/unit/utils.py
@@ -172,6 +172,7 @@ class MockHttpTest(testtools.TestCase):
query_string = kwargs.get('query_string')
storage_url = kwargs.get('storage_url')
auth_token = kwargs.get('auth_token')
+ exc = kwargs.get('exc')
def wrapper(url, proxy=None, cacert=None, insecure=False,
ssl_compression=True):
@@ -192,6 +193,8 @@ class MockHttpTest(testtools.TestCase):
if url.endswith('invalid_cert') and not insecure:
from swiftclient import client as c
raise c.ClientException("invalid_certificate")
+ elif exc:
+ raise exc
return
conn.request = request