summaryrefslogtreecommitdiff
path: root/tests/unit/test_command_helpers.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/test_command_helpers.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/test_command_helpers.py')
-rw-r--r--tests/unit/test_command_helpers.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/tests/unit/test_command_helpers.py b/tests/unit/test_command_helpers.py
index 67e9ac2..d9d7efa 100644
--- a/tests/unit/test_command_helpers.py
+++ b/tests/unit/test_command_helpers.py
@@ -13,11 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-try:
- from unittest import mock
-except ImportError:
- import mock
-
+import mock
from six import StringIO
import testtools