diff --git a/test/unit/common/middleware/test_gatekeeper.py b/test/unit/common/middleware/test_gatekeeper.py index 8c205afa31..888aeb6204 100644 --- a/test/unit/common/middleware/test_gatekeeper.py +++ b/test/unit/common/middleware/test_gatekeeper.py @@ -87,13 +87,11 @@ class TestGatekeeper(unittest.TestCase): def _assertHeadersEqual(self, expected, actual): for key in expected: - self.assertTrue(key.lower() in actual, - '%s missing from %s' % (key, actual)) + self.assertIn(key.lower(), actual) def _assertHeadersAbsent(self, unexpected, actual): for key in unexpected: - self.assertNotIn(key.lower(), actual, - '%s is in %s' % (key, actual)) + self.assertNotIn(key.lower(), 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 fa5d001c9b..cdeab51636 100644 --- a/test/unit/common/middleware/test_proxy_logging.py +++ b/test/unit/common/middleware/test_proxy_logging.py @@ -449,8 +449,8 @@ class TestProxyLogging(unittest.TestCase): [x for x in resp] log_parts = self._log_parts(app) headers = unquote(log_parts[14]).split('\n') - self.assertTrue('First: 1' in headers) - self.assertTrue('Second: 2' in headers) + self.assertIn('First: 1', headers) + self.assertIn('Second: 2', headers) self.assertNotIn('Third: 3', headers) self.assertNotIn('Host: localhost:80', headers) diff --git a/test/unit/common/middleware/test_slo.py b/test/unit/common/middleware/test_slo.py index 905755cf3b..7238aa70b5 100644 --- a/test/unit/common/middleware/test_slo.py +++ b/test/unit/common/middleware/test_slo.py @@ -513,8 +513,10 @@ class TestSloPutManifest(SloTestCase): body=test_json_data) 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') + self.assertIn('X-Static-Large-Object', req.headers) + self.assertEqual(req.environ['PATH_INFO'], '/v1/AUTH_test/c/man') + self.assertIn(('HEAD', '/v1/AUTH_test/cont/object\xe2\x99\xa1'), + self.app.calls) def test_handle_multipart_put_no_xml(self): req = Request.blank( diff --git a/test/unit/common/middleware/test_staticweb.py b/test/unit/common/middleware/test_staticweb.py index d6f89a4870..e25028cc1d 100644 --- a/test/unit/common/middleware/test_staticweb.py +++ b/test/unit/common/middleware/test_staticweb.py @@ -554,8 +554,8 @@ class TestStaticWeb(unittest.TestCase): resp = Request.blank( '/v1/a/c3/subdir/').get_response(self.test_staticweb) self.assertEqual(resp.status_int, 200) - self.assertTrue('Listing of /v1/a/c3/subdir/' in resp.body) - self.assertTrue('' in resp.body) + self.assertIn('Listing of /v1/a/c3/subdir/', resp.body) + self.assertIn('', resp.body) self.assertNotIn('', resp.body) - self.assertTrue('