summaryrefslogtreecommitdiff
path: root/tests/unit/utils.py
diff options
context:
space:
mode:
authorTim Burke <tim.burke@gmail.com>2015-09-09 17:41:21 -0700
committerTim Burke <tim.burke@gmail.com>2015-10-07 22:33:42 -0700
commit9fed7ed5e1f6dd3e589a35e3ee4abecb676f2188 (patch)
tree9fc610c348fc753a98422b3f8551ca2a8a3776d4 /tests/unit/utils.py
parent43b2c6bfe5140f32a37638985bd4cb7b73988160 (diff)
downloadpython-swiftclient-9fed7ed5e1f6dd3e589a35e3ee4abecb676f2188.tar.gz
Miscellaneous (mostly test) cleanup
* Always use testtools.TestCase, since we're relying on testtools * Always use mock (as opposed to unittest.mock) since we're relying on mock * Add note about when a missing logging handler was added * Stop %-formatting the giant usage string that doesn't actually need any formatting * Prefer assertIs, assertIn, assertIsInstance over assertTrue * Use else-self.fail instead of sentinel values * Check resp.get('error') is None before checking resp['success'] is True, so test failures actually tell you something useful * Tighten some isinstance assertions * Import MockHttpTest from correct location * Only populate clean_os_environ once * Use setUp for setup, not __init__ * Replace assertIn(key, dict) and assertEqual(foo, dict[key]) with assertEqual(foo, dict.get(key)) when key is a literal and foo is not None * Use mock.patch.object instead of manually patching for tests * Use six.binary_type instead of type(''.encode('utf-8')) * Stop shadowing builtin bytes * Reclaim some margin * Stop checking the return-type of encode_utf8; we already know it's bytes Change-Id: I2138ea553378ce88810b7353147c8645a8f8c90e
Diffstat (limited to 'tests/unit/utils.py')
-rw-r--r--tests/unit/utils.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/unit/utils.py b/tests/unit/utils.py
index 20272aa..63b9c06 100644
--- a/tests/unit/utils.py
+++ b/tests/unit/utils.py
@@ -263,9 +263,8 @@ class MockHttpTest(testtools.TestCase):
conn.resp.status = status
if auth_token:
headers = args[1]
- self.assertTrue('X-Auth-Token' in headers)
- actual_token = headers.get('X-Auth-Token')
- self.assertEqual(auth_token, actual_token)
+ self.assertEqual(auth_token,
+ headers.get('X-Auth-Token'))
if query_string:
self.assertTrue(url.endswith('?' + query_string))
if url.endswith('invalid_cert') and not insecure: