diff --git a/test/unit/account/test_server.py b/test/unit/account/test_server.py
index 38ded6a97b..3882c08aa2 100644
--- a/test/unit/account/test_server.py
+++ b/test/unit/account/test_server.py
@@ -77,7 +77,7 @@ class TestAccountController(unittest.TestCase):
'HTTP_X_TIMESTAMP': '0'})
resp = req.get_response(self.controller)
self.assertEqual(resp.status_int, 404)
- self.assertTrue('X-Account-Status' not in resp.headers)
+ self.assertNotIn('X-Account-Status', resp.headers)
def test_DELETE_empty(self):
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'PUT',
@@ -243,7 +243,7 @@ class TestAccountController(unittest.TestCase):
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'HEAD'})
resp = req.get_response(self.controller)
self.assertEqual(resp.status_int, 404)
- self.assertTrue('X-Account-Status' not in resp.headers)
+ self.assertNotIn('X-Account-Status', resp.headers)
# Test the case in which account was deleted but not yet reaped
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'PUT',
@@ -356,7 +356,7 @@ class TestAccountController(unittest.TestCase):
'X-Timestamp': normalize_timestamp(0)})
resp = req.get_response(self.controller)
self.assertEqual(resp.status_int, 404)
- self.assertTrue('X-Account-Status' not in resp.headers)
+ self.assertNotIn('X-Account-Status', resp.headers)
def test_PUT(self):
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'PUT',
@@ -501,7 +501,7 @@ class TestAccountController(unittest.TestCase):
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'GET'})
resp = req.get_response(self.controller)
self.assertEqual(resp.status_int, 204)
- self.assertTrue('x-account-meta-test' not in resp.headers)
+ self.assertNotIn('x-account-meta-test', resp.headers)
def test_PUT_GET_sys_metadata(self):
prefix = get_sys_meta_prefix('account')
@@ -562,7 +562,7 @@ class TestAccountController(unittest.TestCase):
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'GET'})
resp = req.get_response(self.controller)
self.assertEqual(resp.status_int, 204)
- self.assertTrue(hdr not in resp.headers)
+ self.assertNotIn(hdr, resp.headers)
def test_PUT_invalid_partition(self):
req = Request.blank('/sda1/./a', environ={'REQUEST_METHOD': 'PUT',
@@ -626,7 +626,7 @@ class TestAccountController(unittest.TestCase):
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'HEAD'})
resp = req.get_response(self.controller)
self.assertEqual(resp.status_int, 204)
- self.assertTrue('x-account-meta-test' not in resp.headers)
+ self.assertNotIn('x-account-meta-test', resp.headers)
def test_POST_HEAD_sys_metadata(self):
prefix = get_sys_meta_prefix('account')
@@ -679,7 +679,7 @@ class TestAccountController(unittest.TestCase):
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'HEAD'})
resp = req.get_response(self.controller)
self.assertEqual(resp.status_int, 204)
- self.assertTrue(hdr not in resp.headers)
+ self.assertNotIn(hdr, resp.headers)
def test_POST_invalid_partition(self):
req = Request.blank('/sda1/./a', environ={'REQUEST_METHOD': 'POST',
@@ -721,7 +721,7 @@ class TestAccountController(unittest.TestCase):
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'GET'})
resp = req.get_response(self.controller)
self.assertEqual(resp.status_int, 404)
- self.assertTrue('X-Account-Status' not in resp.headers)
+ self.assertNotIn('X-Account-Status', resp.headers)
# Test the case in which account was deleted but not yet reaped
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'PUT',
@@ -1963,7 +1963,7 @@ class TestAccountController(unittest.TestCase):
resp = req.get_response(self.controller)
self.assertEqual(resp.status_int // 100, 2)
for key in resp.headers:
- self.assertTrue('storage-policy' not in key.lower())
+ self.assertNotIn('storage-policy', key.lower())
def test_empty_except_for_used_policies(self):
ts = itertools.count()
@@ -1979,7 +1979,7 @@ class TestAccountController(unittest.TestCase):
resp = req.get_response(self.controller)
self.assertEqual(resp.status_int // 100, 2)
for key in resp.headers:
- self.assertTrue('storage-policy' not in key.lower())
+ self.assertNotIn('storage-policy', key.lower())
# add a container
policy = random.choice(POLICIES)
diff --git a/test/unit/common/middleware/test_formpost.py b/test/unit/common/middleware/test_formpost.py
index fabfe1931f..c5fbc027a4 100644
--- a/test/unit/common/middleware/test_formpost.py
+++ b/test/unit/common/middleware/test_formpost.py
@@ -242,7 +242,7 @@ class TestFormPost(unittest.TestCase):
'/v1/a/c/o',
environ={'REQUEST_METHOD': method}).get_response(self.formpost)
self.assertEqual(resp.status_int, 401)
- self.assertTrue('FormPost' not in resp.body)
+ self.assertNotIn('FormPost', resp.body)
def test_auth_scheme(self):
# FormPost rejects
diff --git a/test/unit/common/middleware/test_gatekeeper.py b/test/unit/common/middleware/test_gatekeeper.py
index d07c4c007a..8c205afa31 100644
--- a/test/unit/common/middleware/test_gatekeeper.py
+++ b/test/unit/common/middleware/test_gatekeeper.py
@@ -92,8 +92,8 @@ class TestGatekeeper(unittest.TestCase):
def _assertHeadersAbsent(self, unexpected, actual):
for key in unexpected:
- self.assertTrue(key.lower() not in actual,
- '%s is in %s' % (key, actual))
+ self.assertNotIn(key.lower(), actual,
+ '%s is in %s' % (key, actual))
def get_app(self, app, global_conf, **local_conf):
factory = gatekeeper.filter_factory(global_conf, **local_conf)
diff --git a/test/unit/common/middleware/test_proxy_logging.py b/test/unit/common/middleware/test_proxy_logging.py
index 2282a9f1b7..909a96dac2 100644
--- a/test/unit/common/middleware/test_proxy_logging.py
+++ b/test/unit/common/middleware/test_proxy_logging.py
@@ -455,8 +455,8 @@ class TestProxyLogging(unittest.TestCase):
headers = unquote(log_parts[14]).split('\n')
self.assertTrue('First: 1' in headers)
self.assertTrue('Second: 2' in headers)
- self.assertTrue('Third: 3' not in headers)
- self.assertTrue('Host: localhost:80' not in headers)
+ self.assertNotIn('Third: 3', headers)
+ self.assertNotIn('Host: localhost:80', headers)
def test_upload_size(self):
# Using default policy
diff --git a/test/unit/common/middleware/test_slo.py b/test/unit/common/middleware/test_slo.py
index f0aba94a12..6f428b74de 100644
--- a/test/unit/common/middleware/test_slo.py
+++ b/test/unit/common/middleware/test_slo.py
@@ -468,7 +468,7 @@ class TestSloPutManifest(SloTestCase):
'/v1/AUTH_test/c/man?multipart-manifest=put',
environ={'REQUEST_METHOD': 'PUT'}, headers={'Accept': 'test'},
body=test_json_data)
- self.assertTrue('X-Static-Large-Object' not in req.headers)
+ self.assertNotIn('X-Static-Large-Object', req.headers)
self.slo(req.environ, fake_start_response)
self.assertTrue('X-Static-Large-Object' in req.headers)
self.assertTrue(req.environ['PATH_INFO'], '/cont/object\xe2\x99\xa1')
@@ -1728,7 +1728,7 @@ class TestSloGetManifest(SloTestCase):
self.assertEqual(status, '206 Partial Content')
self.assertEqual(headers['Content-Length'], '15')
- self.assertTrue('Etag' not in headers)
+ self.assertNotIn('Etag', headers)
self.assertEqual(body, 'aabbbbbbbbbbccc')
self.assertEqual(
@@ -1973,7 +1973,7 @@ class TestSloGetManifest(SloTestCase):
self.assertEqual(status, '206 Partial Content')
self.assertEqual(headers['Content-Length'], '25')
- self.assertTrue('Etag' not in headers)
+ self.assertNotIn('Etag', headers)
self.assertEqual(body, 'bbbbbbbbbbccccccccccccccc')
self.assertEqual(
diff --git a/test/unit/common/middleware/test_staticweb.py b/test/unit/common/middleware/test_staticweb.py
index 2011340b51..d6f89a4870 100644
--- a/test/unit/common/middleware/test_staticweb.py
+++ b/test/unit/common/middleware/test_staticweb.py
@@ -556,8 +556,8 @@ class TestStaticWeb(unittest.TestCase):
self.assertEqual(resp.status_int, 200)
self.assertTrue('Listing of /v1/a/c3/subdir/' in resp.body)
self.assertTrue('' in resp.body)
- self.assertTrue('' not in resp.body)
+ self.assertNotIn('', resp.body)
self.assertTrue('