diff --git a/test/functional/tests.py b/test/functional/tests.py
index dd92827a4f..8f7e2e8d17 100644
--- a/test/functional/tests.py
+++ b/test/functional/tests.py
@@ -2863,7 +2863,7 @@ class TestObjectVersioning(Base):
container = self.env.container
versions_container = self.env.versions_container
cont_info = container.info()
- self.assertEquals(cont_info['versions'], versions_container.name)
+ self.assertEqual(cont_info['versions'], versions_container.name)
obj_name = Utils.create_name()
diff --git a/test/probe/test_account_failures.py b/test/probe/test_account_failures.py
index 4d6b1496b9..9f7adc0a34 100755
--- a/test/probe/test_account_failures.py
+++ b/test/probe/test_account_failures.py
@@ -187,7 +187,7 @@ class TestAccountFailures(ReplProbeTest):
found2 = True
self.assertEqual(container['count'], 2)
self.assertEqual(container['bytes'], 9)
- self.assertEquals(container['bytes'], 9)
+ self.assertEqual(container['bytes'], 9)
self.assertFalse(found1)
self.assertTrue(found2)
diff --git a/test/unit/common/middleware/test_account_quotas.py b/test/unit/common/middleware/test_account_quotas.py
index e8e461fd53..345e178cd1 100644
--- a/test/unit/common/middleware/test_account_quotas.py
+++ b/test/unit/common/middleware/test_account_quotas.py
@@ -97,7 +97,7 @@ class TestAccountQuota(unittest.TestCase):
'swift.cache': cache})
res = req.get_response(app)
# Response code of 200 because authentication itself is not done here
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_no_quotas(self):
headers = [('x-account-bytes-used', '1000'), ]
@@ -107,7 +107,7 @@ class TestAccountQuota(unittest.TestCase):
environ={'REQUEST_METHOD': 'PUT',
'swift.cache': cache})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_obj_request_ignores_attempt_to_set_quotas(self):
# If you try to set X-Account-Meta-* on an object, it's ignored, so
@@ -121,7 +121,7 @@ class TestAccountQuota(unittest.TestCase):
environ={'REQUEST_METHOD': 'PUT',
'swift.cache': cache})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_container_request_ignores_attempt_to_set_quotas(self):
# As with an object, if you try to set X-Account-Meta-* on a
@@ -134,7 +134,7 @@ class TestAccountQuota(unittest.TestCase):
environ={'REQUEST_METHOD': 'PUT',
'swift.cache': cache})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_bogus_quota_is_ignored(self):
# This can happen if the metadata was set by a user prior to the
@@ -147,7 +147,7 @@ class TestAccountQuota(unittest.TestCase):
environ={'REQUEST_METHOD': 'PUT',
'swift.cache': cache})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_exceed_bytes_quota(self):
headers = [('x-account-bytes-used', '1000'),
@@ -158,8 +158,8 @@ class TestAccountQuota(unittest.TestCase):
environ={'REQUEST_METHOD': 'PUT',
'swift.cache': cache})
res = req.get_response(app)
- self.assertEquals(res.status_int, 413)
- self.assertEquals(res.body, 'Upload exceeds quota.')
+ self.assertEqual(res.status_int, 413)
+ self.assertEqual(res.body, 'Upload exceeds quota.')
def test_exceed_quota_not_authorized(self):
headers = [('x-account-bytes-used', '1000'),
@@ -171,7 +171,7 @@ class TestAccountQuota(unittest.TestCase):
headers={'x-auth-token': 'bad-secret'},
environ={'swift.cache': cache})
res = req.get_response(app)
- self.assertEquals(res.status_int, 403)
+ self.assertEqual(res.status_int, 403)
def test_exceed_quota_authorized(self):
headers = [('x-account-bytes-used', '1000'),
@@ -183,7 +183,7 @@ class TestAccountQuota(unittest.TestCase):
headers={'x-auth-token': 'secret'},
environ={'swift.cache': cache})
res = req.get_response(app)
- self.assertEquals(res.status_int, 413)
+ self.assertEqual(res.status_int, 413)
def test_under_quota_not_authorized(self):
headers = [('x-account-bytes-used', '0'),
@@ -195,7 +195,7 @@ class TestAccountQuota(unittest.TestCase):
headers={'x-auth-token': 'bad-secret'},
environ={'swift.cache': cache})
res = req.get_response(app)
- self.assertEquals(res.status_int, 403)
+ self.assertEqual(res.status_int, 403)
def test_under_quota_authorized(self):
headers = [('x-account-bytes-used', '0'),
@@ -207,7 +207,7 @@ class TestAccountQuota(unittest.TestCase):
headers={'x-auth-token': 'secret'},
environ={'swift.cache': cache})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_over_quota_container_create_still_works(self):
headers = [('x-account-bytes-used', '1001'),
@@ -219,7 +219,7 @@ class TestAccountQuota(unittest.TestCase):
'HTTP_X_CONTAINER_META_BERT': 'ernie',
'swift.cache': cache})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_over_quota_container_post_still_works(self):
headers = [('x-account-bytes-used', '1001'),
@@ -231,7 +231,7 @@ class TestAccountQuota(unittest.TestCase):
'HTTP_X_CONTAINER_META_BERT': 'ernie',
'swift.cache': cache})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_over_quota_obj_post_still_works(self):
headers = [('x-account-bytes-used', '1001'),
@@ -243,7 +243,7 @@ class TestAccountQuota(unittest.TestCase):
'HTTP_X_OBJECT_META_BERT': 'ernie',
'swift.cache': cache})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_exceed_bytes_quota_copy_from(self):
headers = [('x-account-bytes-used', '500'),
@@ -256,8 +256,8 @@ class TestAccountQuota(unittest.TestCase):
'swift.cache': cache},
headers={'x-copy-from': '/c2/o2'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 413)
- self.assertEquals(res.body, 'Upload exceeds quota.')
+ self.assertEqual(res.status_int, 413)
+ self.assertEqual(res.body, 'Upload exceeds quota.')
def test_exceed_bytes_quota_copy_verb(self):
headers = [('x-account-bytes-used', '500'),
@@ -270,8 +270,8 @@ class TestAccountQuota(unittest.TestCase):
'swift.cache': cache},
headers={'Destination': '/c/o'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 413)
- self.assertEquals(res.body, 'Upload exceeds quota.')
+ self.assertEqual(res.status_int, 413)
+ self.assertEqual(res.body, 'Upload exceeds quota.')
def test_not_exceed_bytes_quota_copy_from(self):
headers = [('x-account-bytes-used', '0'),
@@ -284,7 +284,7 @@ class TestAccountQuota(unittest.TestCase):
'swift.cache': cache},
headers={'x-copy-from': '/c2/o2'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_not_exceed_bytes_quota_copy_verb(self):
headers = [('x-account-bytes-used', '0'),
@@ -297,7 +297,7 @@ class TestAccountQuota(unittest.TestCase):
'swift.cache': cache},
headers={'Destination': '/c/o'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_quota_copy_from_no_src(self):
headers = [('x-account-bytes-used', '0'),
@@ -309,7 +309,7 @@ class TestAccountQuota(unittest.TestCase):
'swift.cache': cache},
headers={'x-copy-from': '/c2/o3'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_quota_copy_from_bad_src(self):
headers = [('x-account-bytes-used', '0'),
@@ -321,7 +321,7 @@ class TestAccountQuota(unittest.TestCase):
'swift.cache': cache},
headers={'x-copy-from': 'bad_path'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 412)
+ self.assertEqual(res.status_int, 412)
def test_exceed_bytes_quota_reseller(self):
headers = [('x-account-bytes-used', '1000'),
@@ -333,7 +333,7 @@ class TestAccountQuota(unittest.TestCase):
'swift.cache': cache,
'reseller_request': True})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_exceed_bytes_quota_reseller_copy_from(self):
headers = [('x-account-bytes-used', '500'),
@@ -347,7 +347,7 @@ class TestAccountQuota(unittest.TestCase):
'reseller_request': True},
headers={'x-copy-from': 'c2/o2'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_exceed_bytes_quota_reseller_copy_verb(self):
headers = [('x-account-bytes-used', '500'),
@@ -361,7 +361,7 @@ class TestAccountQuota(unittest.TestCase):
'reseller_request': True},
headers={'Destination': 'c/o'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_bad_application_quota(self):
headers = []
@@ -371,7 +371,7 @@ class TestAccountQuota(unittest.TestCase):
environ={'REQUEST_METHOD': 'PUT',
'swift.cache': cache})
res = req.get_response(app)
- self.assertEquals(res.status_int, 404)
+ self.assertEqual(res.status_int, 404)
def test_no_info_quota(self):
headers = []
@@ -381,7 +381,7 @@ class TestAccountQuota(unittest.TestCase):
environ={'REQUEST_METHOD': 'PUT',
'swift.cache': cache})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_not_exceed_bytes_quota(self):
headers = [('x-account-bytes-used', '1000'),
@@ -392,7 +392,7 @@ class TestAccountQuota(unittest.TestCase):
environ={'REQUEST_METHOD': 'PUT',
'swift.cache': cache})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_invalid_quotas(self):
headers = [('x-account-bytes-used', '0'), ]
@@ -404,7 +404,7 @@ class TestAccountQuota(unittest.TestCase):
'HTTP_X_ACCOUNT_META_QUOTA_BYTES': 'abc',
'reseller_request': True})
res = req.get_response(app)
- self.assertEquals(res.status_int, 400)
+ self.assertEqual(res.status_int, 400)
def test_valid_quotas_admin(self):
headers = [('x-account-bytes-used', '0'), ]
@@ -415,7 +415,7 @@ class TestAccountQuota(unittest.TestCase):
'swift.cache': cache,
'HTTP_X_ACCOUNT_META_QUOTA_BYTES': '100'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 403)
+ self.assertEqual(res.status_int, 403)
def test_valid_quotas_reseller(self):
headers = [('x-account-bytes-used', '0'), ]
@@ -427,7 +427,7 @@ class TestAccountQuota(unittest.TestCase):
'HTTP_X_ACCOUNT_META_QUOTA_BYTES': '100',
'reseller_request': True})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_delete_quotas(self):
headers = [('x-account-bytes-used', '0'), ]
@@ -438,7 +438,7 @@ class TestAccountQuota(unittest.TestCase):
'swift.cache': cache,
'HTTP_X_ACCOUNT_META_QUOTA_BYTES': ''})
res = req.get_response(app)
- self.assertEquals(res.status_int, 403)
+ self.assertEqual(res.status_int, 403)
def test_delete_quotas_with_remove_header(self):
headers = [('x-account-bytes-used', '0'), ]
@@ -449,7 +449,7 @@ class TestAccountQuota(unittest.TestCase):
'swift.cache': cache,
'HTTP_X_REMOVE_ACCOUNT_META_QUOTA_BYTES': 'True'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 403)
+ self.assertEqual(res.status_int, 403)
def test_delete_quotas_reseller(self):
headers = [('x-account-bytes-used', '0'), ]
@@ -459,7 +459,7 @@ class TestAccountQuota(unittest.TestCase):
'HTTP_X_ACCOUNT_META_QUOTA_BYTES': '',
'reseller_request': True})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_delete_quotas_with_remove_header_reseller(self):
headers = [('x-account-bytes-used', '0'), ]
@@ -471,7 +471,7 @@ class TestAccountQuota(unittest.TestCase):
'HTTP_X_REMOVE_ACCOUNT_META_QUOTA_BYTES': 'True',
'reseller_request': True})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_invalid_request_exception(self):
headers = [('x-account-bytes-used', '1000'), ]
@@ -482,7 +482,7 @@ class TestAccountQuota(unittest.TestCase):
'swift.cache': cache})
res = req.get_response(app)
# Response code of 200 because authentication itself is not done here
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
if __name__ == '__main__':
diff --git a/test/unit/common/middleware/test_acl.py b/test/unit/common/middleware/test_acl.py
index aa100bc4db..614056c0f2 100644
--- a/test/unit/common/middleware/test_acl.py
+++ b/test/unit/common/middleware/test_acl.py
@@ -22,36 +22,36 @@ class TestACL(unittest.TestCase):
def test_clean_acl(self):
value = acl.clean_acl('header', '.r:*')
- self.assertEquals(value, '.r:*')
+ self.assertEqual(value, '.r:*')
value = acl.clean_acl('header', '.r:specific.host')
- self.assertEquals(value, '.r:specific.host')
+ self.assertEqual(value, '.r:specific.host')
value = acl.clean_acl('header', '.r:.ending.with')
- self.assertEquals(value, '.r:.ending.with')
+ self.assertEqual(value, '.r:.ending.with')
value = acl.clean_acl('header', '.r:*.ending.with')
- self.assertEquals(value, '.r:.ending.with')
+ self.assertEqual(value, '.r:.ending.with')
value = acl.clean_acl('header', '.r:-*.ending.with')
- self.assertEquals(value, '.r:-.ending.with')
+ self.assertEqual(value, '.r:-.ending.with')
value = acl.clean_acl('header', '.r:one,.r:two')
- self.assertEquals(value, '.r:one,.r:two')
+ self.assertEqual(value, '.r:one,.r:two')
value = acl.clean_acl('header', '.r:*,.r:-specific.host')
- self.assertEquals(value, '.r:*,.r:-specific.host')
+ self.assertEqual(value, '.r:*,.r:-specific.host')
value = acl.clean_acl('header', '.r:*,.r:-.ending.with')
- self.assertEquals(value, '.r:*,.r:-.ending.with')
+ self.assertEqual(value, '.r:*,.r:-.ending.with')
value = acl.clean_acl('header', '.r:one,.r:-two')
- self.assertEquals(value, '.r:one,.r:-two')
+ self.assertEqual(value, '.r:one,.r:-two')
value = acl.clean_acl('header', '.r:one,.r:-two,account,account:user')
- self.assertEquals(value, '.r:one,.r:-two,account,account:user')
+ self.assertEqual(value, '.r:one,.r:-two,account,account:user')
value = acl.clean_acl('header', 'TEST_account')
- self.assertEquals(value, 'TEST_account')
+ self.assertEqual(value, 'TEST_account')
value = acl.clean_acl('header', '.ref:*')
- self.assertEquals(value, '.r:*')
+ self.assertEqual(value, '.r:*')
value = acl.clean_acl('header', '.referer:*')
- self.assertEquals(value, '.r:*')
+ self.assertEqual(value, '.r:*')
value = acl.clean_acl('header', '.referrer:*')
- self.assertEquals(value, '.r:*')
+ self.assertEqual(value, '.r:*')
value = acl.clean_acl('header',
' .r : one , ,, .r:two , .r : - three ')
- self.assertEquals(value, '.r:one,.r:two,.r:-three')
+ self.assertEqual(value, '.r:one,.r:two,.r:-three')
self.assertRaises(ValueError, acl.clean_acl, 'header', '.unknown:test')
self.assertRaises(ValueError, acl.clean_acl, 'header', '.r:')
self.assertRaises(ValueError, acl.clean_acl, 'header', '.r:*.')
@@ -67,16 +67,16 @@ class TestACL(unittest.TestCase):
self.assertRaises(ValueError, acl.clean_acl, 'write-header', '.r:r')
def test_parse_acl(self):
- self.assertEquals(acl.parse_acl(None), ([], []))
- self.assertEquals(acl.parse_acl(''), ([], []))
- self.assertEquals(acl.parse_acl('.r:ref1'), (['ref1'], []))
- self.assertEquals(acl.parse_acl('.r:-ref1'), (['-ref1'], []))
- self.assertEquals(acl.parse_acl('account:user'),
- ([], ['account:user']))
- self.assertEquals(acl.parse_acl('account'), ([], ['account']))
- self.assertEquals(acl.parse_acl('acc1,acc2:usr2,.r:ref3,.r:-ref4'),
- (['ref3', '-ref4'], ['acc1', 'acc2:usr2']))
- self.assertEquals(acl.parse_acl(
+ self.assertEqual(acl.parse_acl(None), ([], []))
+ self.assertEqual(acl.parse_acl(''), ([], []))
+ self.assertEqual(acl.parse_acl('.r:ref1'), (['ref1'], []))
+ self.assertEqual(acl.parse_acl('.r:-ref1'), (['-ref1'], []))
+ self.assertEqual(acl.parse_acl('account:user'),
+ ([], ['account:user']))
+ self.assertEqual(acl.parse_acl('account'), ([], ['account']))
+ self.assertEqual(acl.parse_acl('acc1,acc2:usr2,.r:ref3,.r:-ref4'),
+ (['ref3', '-ref4'], ['acc1', 'acc2:usr2']))
+ self.assertEqual(acl.parse_acl(
'acc1,acc2:usr2,.r:ref3,acc3,acc4:usr4,.r:ref5,.r:-ref6'),
(['ref3', 'ref5', '-ref6'],
['acc1', 'acc2:usr2', 'acc3', 'acc4:usr4']))
@@ -105,8 +105,8 @@ class TestACL(unittest.TestCase):
for hdrs_in, expected in tests:
result = acl.parse_acl(version=2, data=hdrs_in.get('hdr'))
- self.assertEquals(expected, result,
- '%r: %r != %r' % (hdrs_in, result, expected))
+ self.assertEqual(expected, result,
+ '%r: %r != %r' % (hdrs_in, result, expected))
def test_format_v1_acl(self):
tests = [
@@ -120,8 +120,8 @@ class TestACL(unittest.TestCase):
for (groups, refs), expected in tests:
result = acl.format_acl(
version=1, groups=groups, referrers=refs, header_name='hdr')
- self.assertEquals(expected, result, 'groups=%r, refs=%r: %r != %r'
- % (groups, refs, result, expected))
+ self.assertEqual(expected, result, 'groups=%r, refs=%r: %r != %r'
+ % (groups, refs, result, expected))
def test_format_v2_acl(self):
tests = [
@@ -133,8 +133,8 @@ class TestACL(unittest.TestCase):
for data, expected in tests:
result = acl.format_acl(version=2, acl_dict=data)
- self.assertEquals(expected, result,
- 'data=%r: %r *!=* %r' % (data, result, expected))
+ self.assertEqual(expected, result,
+ 'data=%r: %r *!=* %r' % (data, result, expected))
def test_acls_from_account_info(self):
test_data = [
diff --git a/test/unit/common/middleware/test_bulk.py b/test/unit/common/middleware/test_bulk.py
index a3982887c9..a024a94ff6 100644
--- a/test/unit/common/middleware/test_bulk.py
+++ b/test/unit/common/middleware/test_bulk.py
@@ -248,15 +248,15 @@ class TestUntar(unittest.TestCase):
def test_create_container_for_path(self):
req = Request.blank('/')
- self.assertEquals(
+ self.assertEqual(
self.bulk.create_container(req, '/create_cont/acc/cont'),
True)
- self.assertEquals(self.app.calls, 2)
+ self.assertEqual(self.app.calls, 2)
self.assertRaises(
bulk.CreateContainerError,
self.bulk.create_container,
req, '/create_cont_fail/acc/cont')
- self.assertEquals(self.app.calls, 3)
+ self.assertEqual(self.app.calls, 3)
def test_extract_tar_works(self):
# On systems where $TMPDIR is long (like OS X), we need to do this
@@ -289,7 +289,7 @@ class TestUntar(unittest.TestCase):
req.headers['transfer-encoding'] = 'chunked'
resp_body = self.handle_extract_and_iter(req, compress_format)
resp_data = utils.json.loads(resp_body)
- self.assertEquals(resp_data['Number Files Created'], 6)
+ self.assertEqual(resp_data['Number Files Created'], 6)
# test out xml
req = Request.blank('/tar_works/acc/cont/')
@@ -342,7 +342,7 @@ class TestUntar(unittest.TestCase):
req.environ['wsgi.input'] = open(
os.path.join(self.testdir, 'tar_works.tar.gz'))
self.bulk(req.environ, fake_start_response)
- self.assertEquals(self.app.calls, 1)
+ self.assertEqual(self.app.calls, 1)
self.app.calls = 0
req.environ['wsgi.input'] = open(
@@ -351,7 +351,7 @@ class TestUntar(unittest.TestCase):
req.method = 'PUT'
app_iter = self.bulk(req.environ, fake_start_response)
list(app_iter) # iter over resp
- self.assertEquals(self.app.calls, 7)
+ self.assertEqual(self.app.calls, 7)
self.app.calls = 0
req = Request.blank('/tar_works/acc/cont/?extract-archive=bad')
@@ -360,7 +360,7 @@ class TestUntar(unittest.TestCase):
req.environ['wsgi.input'] = open(
os.path.join(self.testdir, 'tar_works.tar.gz'))
t = self.bulk(req.environ, fake_start_response)
- self.assertEquals(t[0], "Unsupported archive format")
+ self.assertEqual(t[0], "Unsupported archive format")
tar = tarfile.open(name=os.path.join(self.testdir,
'tar_works.tar'),
@@ -375,7 +375,7 @@ class TestUntar(unittest.TestCase):
os.path.join(self.testdir, 'tar_works.tar'))
app_iter = self.bulk(req.environ, fake_start_response)
list(app_iter) # iter over resp
- self.assertEquals(self.app.calls, 7)
+ self.assertEqual(self.app.calls, 7)
def test_bad_container(self):
req = Request.blank('/invalid/', body='')
@@ -424,7 +424,7 @@ class TestUntar(unittest.TestCase):
req.headers['transfer-encoding'] = 'chunked'
resp_body = self.handle_extract_and_iter(req, '')
resp_data = utils.json.loads(resp_body)
- self.assertEquals(resp_data['Number Files Created'], 4)
+ self.assertEqual(resp_data['Number Files Created'], 4)
def test_extract_tar_fail_cont_401(self):
self.build_tar()
@@ -434,10 +434,10 @@ class TestUntar(unittest.TestCase):
'tar_fails.tar'))
req.headers['transfer-encoding'] = 'chunked'
resp_body = self.handle_extract_and_iter(req, '')
- self.assertEquals(self.app.calls, 1)
+ self.assertEqual(self.app.calls, 1)
resp_data = utils.json.loads(resp_body)
- self.assertEquals(resp_data['Response Status'], '401 Unauthorized')
- self.assertEquals(resp_data['Errors'], [])
+ self.assertEqual(resp_data['Response Status'], '401 Unauthorized')
+ self.assertEqual(resp_data['Errors'], [])
def test_extract_tar_fail_obj_401(self):
self.build_tar()
@@ -447,10 +447,10 @@ class TestUntar(unittest.TestCase):
'tar_fails.tar'))
req.headers['transfer-encoding'] = 'chunked'
resp_body = self.handle_extract_and_iter(req, '')
- self.assertEquals(self.app.calls, 2)
+ self.assertEqual(self.app.calls, 2)
resp_data = utils.json.loads(resp_body)
- self.assertEquals(resp_data['Response Status'], '401 Unauthorized')
- self.assertEquals(
+ self.assertEqual(resp_data['Response Status'], '401 Unauthorized')
+ self.assertEqual(
resp_data['Errors'],
[['cont/base_fails1/sub_dir1/sub1_file1', '401 Unauthorized']])
@@ -462,10 +462,10 @@ class TestUntar(unittest.TestCase):
'tar_fails.tar'))
req.headers['transfer-encoding'] = 'chunked'
resp_body = self.handle_extract_and_iter(req, '')
- self.assertEquals(self.app.calls, 6)
+ self.assertEqual(self.app.calls, 6)
resp_data = utils.json.loads(resp_body)
- self.assertEquals(resp_data['Number Files Created'], 4)
- self.assertEquals(
+ self.assertEqual(resp_data['Number Files Created'], 4)
+ self.assertEqual(
resp_data['Errors'],
[['cont/base_fails1/' + ('f' * 101), '400 Bad Request']])
@@ -477,10 +477,10 @@ class TestUntar(unittest.TestCase):
'tar_fails.tar'))
req.headers['transfer-encoding'] = 'chunked'
resp_body = self.handle_extract_and_iter(req, 'gz')
- self.assertEquals(self.app.calls, 0)
+ self.assertEqual(self.app.calls, 0)
resp_data = utils.json.loads(resp_body)
- self.assertEquals(resp_data['Response Status'], '400 Bad Request')
- self.assertEquals(
+ self.assertEqual(resp_data['Response Status'], '400 Bad Request')
+ self.assertEqual(
resp_data['Response Body'].lower(),
'invalid tar file: not a gzip file')
@@ -494,10 +494,10 @@ class TestUntar(unittest.TestCase):
'tar_fails.tar'))
req.headers['transfer-encoding'] = 'chunked'
resp_body = self.handle_extract_and_iter(req, '')
- self.assertEquals(self.app.calls, 5)
+ self.assertEqual(self.app.calls, 5)
resp_data = utils.json.loads(resp_body)
- self.assertEquals(resp_data['Number Files Created'], 3)
- self.assertEquals(
+ self.assertEqual(resp_data['Number Files Created'], 3)
+ self.assertEqual(
resp_data['Errors'],
[['cont/base_fails1/' + ('f' * 101), '400 Bad Request']])
@@ -519,7 +519,7 @@ class TestUntar(unittest.TestCase):
req.headers['transfer-encoding'] = 'chunked'
resp_body = self.handle_extract_and_iter(req, '')
resp_data = utils.json.loads(resp_body)
- self.assertEquals(
+ self.assertEqual(
resp_data['Errors'],
[['cont' + self.testdir + '/test/sub_dir1/sub1_file1',
'413 Request Entity Too Large']])
@@ -537,10 +537,10 @@ class TestUntar(unittest.TestCase):
headers={'Accept': 'application/json'})
req.headers['transfer-encoding'] = 'chunked'
resp_body = self.handle_extract_and_iter(req, '')
- self.assertEquals(self.app.calls, 5)
+ self.assertEqual(self.app.calls, 5)
resp_data = utils.json.loads(resp_body)
- self.assertEquals(resp_data['Response Status'], '400 Bad Request')
- self.assertEquals(
+ self.assertEqual(resp_data['Response Status'], '400 Bad Request')
+ self.assertEqual(
resp_data['Response Body'],
'More than 1 containers to create from tar.')
@@ -557,8 +557,8 @@ class TestUntar(unittest.TestCase):
req.headers['transfer-encoding'] = 'chunked'
resp_body = self.handle_extract_and_iter(req, '')
resp_data = utils.json.loads(resp_body)
- self.assertEquals(self.app.calls, 5)
- self.assertEquals(len(resp_data['Errors']), 5)
+ self.assertEqual(self.app.calls, 5)
+ self.assertEqual(len(resp_data['Errors']), 5)
def test_extract_tar_fail_create_cont_value_err(self):
self.build_tar()
@@ -574,9 +574,9 @@ class TestUntar(unittest.TestCase):
with patch.object(self.bulk, 'create_container', bad_create):
resp_body = self.handle_extract_and_iter(req, '')
resp_data = utils.json.loads(resp_body)
- self.assertEquals(self.app.calls, 0)
- self.assertEquals(len(resp_data['Errors']), 5)
- self.assertEquals(
+ self.assertEqual(self.app.calls, 0)
+ self.assertEqual(len(resp_data['Errors']), 5)
+ self.assertEqual(
resp_data['Errors'][0],
['cont/base_fails1/sub_dir1/sub1_file1', '400 Bad Request'])
@@ -592,10 +592,10 @@ class TestUntar(unittest.TestCase):
req.headers['transfer-encoding'] = 'chunked'
resp_body = self.handle_extract_and_iter(req, '')
resp_data = utils.json.loads(resp_body)
- self.assertEquals(self.app.calls, 4)
- self.assertEquals(resp_data['Number Files Created'], 2)
- self.assertEquals(resp_data['Response Status'], '400 Bad Request')
- self.assertEquals(
+ self.assertEqual(self.app.calls, 4)
+ self.assertEqual(resp_data['Number Files Created'], 2)
+ self.assertEqual(resp_data['Response Status'], '400 Bad Request')
+ self.assertEqual(
resp_data['Errors'],
[['sub_dir2/sub2%DEfile1', '412 Precondition Failed'],
['sub_%DEdir3/sub4_dir1/sub4_file1', '412 Precondition Failed']])
@@ -636,42 +636,42 @@ class TestDelete(unittest.TestCase):
resp_body = ''.join(self.bulk.handle_delete_iter(
req, objs_to_delete=objs_to_delete,
out_content_type='application/json'))
- self.assertEquals(
+ self.assertEqual(
self.app.delete_paths, ['/delete_works/AUTH_Acc/c/file_a',
'/delete_works/AUTH_Acc/c/file_d'])
- self.assertEquals(self.app.calls, 2)
+ self.assertEqual(self.app.calls, 2)
resp_data = utils.json.loads(resp_body)
- self.assertEquals(resp_data['Response Status'], '400 Bad Request')
- self.assertEquals(resp_data['Number Deleted'], 2)
- self.assertEquals(resp_data['Number Not Found'], 1)
- self.assertEquals(resp_data['Errors'],
- [['/c/file_c', 'unauthorized']])
+ self.assertEqual(resp_data['Response Status'], '400 Bad Request')
+ self.assertEqual(resp_data['Number Deleted'], 2)
+ self.assertEqual(resp_data['Number Not Found'], 1)
+ self.assertEqual(resp_data['Errors'],
+ [['/c/file_c', 'unauthorized']])
def test_bulk_delete_works_with_POST_verb(self):
req = Request.blank('/delete_works/AUTH_Acc', body='/c/f\n/c/f404',
headers={'Accept': 'application/json'})
req.method = 'POST'
resp_body = self.handle_delete_and_iter(req)
- self.assertEquals(
+ self.assertEqual(
self.app.delete_paths,
['/delete_works/AUTH_Acc/c/f', '/delete_works/AUTH_Acc/c/f404'])
- self.assertEquals(self.app.calls, 2)
+ self.assertEqual(self.app.calls, 2)
resp_data = utils.json.loads(resp_body)
- self.assertEquals(resp_data['Number Deleted'], 1)
- self.assertEquals(resp_data['Number Not Found'], 1)
+ self.assertEqual(resp_data['Number Deleted'], 1)
+ self.assertEqual(resp_data['Number Not Found'], 1)
def test_bulk_delete_works_with_DELETE_verb(self):
req = Request.blank('/delete_works/AUTH_Acc', body='/c/f\n/c/f404',
headers={'Accept': 'application/json'})
req.method = 'DELETE'
resp_body = self.handle_delete_and_iter(req)
- self.assertEquals(
+ self.assertEqual(
self.app.delete_paths,
['/delete_works/AUTH_Acc/c/f', '/delete_works/AUTH_Acc/c/f404'])
- self.assertEquals(self.app.calls, 2)
+ self.assertEqual(self.app.calls, 2)
resp_data = utils.json.loads(resp_body)
- self.assertEquals(resp_data['Number Deleted'], 1)
- self.assertEquals(resp_data['Number Not Found'], 1)
+ self.assertEqual(resp_data['Number Deleted'], 1)
+ self.assertEqual(resp_data['Number Not Found'], 1)
def test_bulk_delete_bad_content_type(self):
req = Request.blank('/delete_works/AUTH_Acc',
@@ -684,11 +684,11 @@ class TestDelete(unittest.TestCase):
req.environ['wsgi.input'] = BytesIO(b'/c/f\n/c/f404')
resp_body = self.handle_delete_and_iter(req)
resp_data = utils.json.loads(resp_body)
- self.assertEquals(resp_data['Response Status'], '406 Not Acceptable')
+ self.assertEqual(resp_data['Response Status'], '406 Not Acceptable')
def test_bulk_delete_call_and_content_type(self):
def fake_start_response(*args, **kwargs):
- self.assertEquals(args[1][0], ('Content-Type', 'application/json'))
+ self.assertEqual(args[1][0], ('Content-Type', 'application/json'))
req = Request.blank('/delete_works/AUTH_Acc?bulk-delete')
req.method = 'POST'
@@ -696,23 +696,23 @@ class TestDelete(unittest.TestCase):
req.headers['Accept'] = 'application/json'
req.environ['wsgi.input'] = BytesIO(b'/c/f%20')
list(self.bulk(req.environ, fake_start_response)) # iterate over resp
- self.assertEquals(
+ self.assertEqual(
self.app.delete_paths, ['/delete_works/AUTH_Acc/c/f '])
- self.assertEquals(self.app.calls, 1)
+ self.assertEqual(self.app.calls, 1)
def test_bulk_delete_get_objs(self):
req = Request.blank('/delete_works/AUTH_Acc', body='1%20\r\n2\r\n')
req.method = 'POST'
with patch.object(self.bulk, 'max_deletes_per_request', 2):
results = self.bulk.get_objs_to_delete(req)
- self.assertEquals(results, [{'name': '1 '}, {'name': '2'}])
+ self.assertEqual(results, [{'name': '1 '}, {'name': '2'}])
with patch.object(self.bulk, 'max_path_length', 2):
results = []
req.environ['wsgi.input'] = BytesIO(b'1\n2\n3')
results = self.bulk.get_objs_to_delete(req)
- self.assertEquals(results,
- [{'name': '1'}, {'name': '2'}, {'name': '3'}])
+ self.assertEqual(results,
+ [{'name': '1'}, {'name': '2'}, {'name': '3'}])
with patch.object(self.bulk, 'max_deletes_per_request', 9):
with patch.object(self.bulk, 'max_path_length', 1):
@@ -727,15 +727,15 @@ class TestDelete(unittest.TestCase):
headers={'Accept': 'application/json'})
req.method = 'POST'
resp_body = self.handle_delete_and_iter(req)
- self.assertEquals(
+ self.assertEqual(
self.app.delete_paths,
['/delete_works/AUTH_Acc/c/f',
'/delete_works/AUTH_Acc/c/f404',
'/delete_works/AUTH_Acc/c/%25'])
- self.assertEquals(self.app.calls, 3)
+ self.assertEqual(self.app.calls, 3)
resp_data = utils.json.loads(resp_body)
- self.assertEquals(resp_data['Number Deleted'], 2)
- self.assertEquals(resp_data['Number Not Found'], 1)
+ self.assertEqual(resp_data['Number Deleted'], 2)
+ self.assertEqual(resp_data['Number Not Found'], 1)
def test_bulk_delete_too_many_newlines(self):
req = Request.blank('/delete_works/AUTH_Acc')
@@ -754,20 +754,20 @@ class TestDelete(unittest.TestCase):
headers={'Accept': 'application/json'})
req.method = 'POST'
resp_body = self.handle_delete_and_iter(req)
- self.assertEquals(
+ self.assertEqual(
self.app.delete_paths,
['/delete_works/AUTH_Acc/c/ obj \xe2\x99\xa1',
'/delete_works/AUTH_Acc/c/ objbadutf8'])
- self.assertEquals(self.app.calls, 2)
+ self.assertEqual(self.app.calls, 2)
resp_data = utils.json.loads(resp_body)
- self.assertEquals(resp_data['Number Deleted'], 1)
- self.assertEquals(len(resp_data['Errors']), 2)
- self.assertEquals(resp_data['Errors'],
- [[urllib.parse.quote('c/ objbadutf8'),
- '412 Precondition Failed'],
- [urllib.parse.quote('/c/f\xdebadutf8'),
- '412 Precondition Failed']])
+ self.assertEqual(resp_data['Number Deleted'], 1)
+ self.assertEqual(len(resp_data['Errors']), 2)
+ self.assertEqual(resp_data['Errors'],
+ [[urllib.parse.quote('c/ objbadutf8'),
+ '412 Precondition Failed'],
+ [urllib.parse.quote('/c/f\xdebadutf8'),
+ '412 Precondition Failed']])
def test_bulk_delete_no_body(self):
req = Request.blank('/unauth/AUTH_acc/')
@@ -784,11 +784,11 @@ class TestDelete(unittest.TestCase):
headers={'Accept': 'application/json'})
req.method = 'POST'
resp_body = self.handle_delete_and_iter(req)
- self.assertEquals(self.app.calls, 2)
+ self.assertEqual(self.app.calls, 2)
resp_data = utils.json.loads(resp_body)
- self.assertEquals(resp_data['Errors'], [['/c/f', '401 Unauthorized']])
- self.assertEquals(resp_data['Response Status'], '400 Bad Request')
- self.assertEquals(resp_data['Number Deleted'], 1)
+ self.assertEqual(resp_data['Errors'], [['/c/f', '401 Unauthorized']])
+ self.assertEqual(resp_data['Response Status'], '400 Bad Request')
+ self.assertEqual(resp_data['Number Deleted'], 1)
def test_bulk_delete_500_resp(self):
req = Request.blank('/broke/AUTH_acc/', body='/c/f\nc/f2\n',
@@ -796,10 +796,10 @@ class TestDelete(unittest.TestCase):
req.method = 'POST'
resp_body = self.handle_delete_and_iter(req)
resp_data = utils.json.loads(resp_body)
- self.assertEquals(
+ self.assertEqual(
resp_data['Errors'],
[['/c/f', '500 Internal Error'], ['c/f2', '500 Internal Error']])
- self.assertEquals(resp_data['Response Status'], '502 Bad Gateway')
+ self.assertEqual(resp_data['Response Status'], '502 Bad Gateway')
def test_bulk_delete_bad_path(self):
req = Request.blank('/delete_cont_fail/')
@@ -815,10 +815,10 @@ class TestDelete(unittest.TestCase):
return_value=None)) as mock_sleep:
resp_body = self.handle_delete_and_iter(req)
resp_data = utils.json.loads(resp_body)
- self.assertEquals(resp_data['Number Deleted'], 0)
- self.assertEquals(resp_data['Errors'], [['c', '409 Conflict']])
- self.assertEquals(resp_data['Response Status'], '400 Bad Request')
- self.assertEquals([], mock_sleep.call_args_list)
+ self.assertEqual(resp_data['Number Deleted'], 0)
+ self.assertEqual(resp_data['Errors'], [['c', '409 Conflict']])
+ self.assertEqual(resp_data['Response Status'], '400 Bad Request')
+ self.assertEqual([], mock_sleep.call_args_list)
def test_bulk_delete_container_delete_retry_and_fails(self):
self.bulk.retry_count = 3
@@ -830,13 +830,13 @@ class TestDelete(unittest.TestCase):
return_value=None)) as mock_sleep:
resp_body = self.handle_delete_and_iter(req)
resp_data = utils.json.loads(resp_body)
- self.assertEquals(resp_data['Number Deleted'], 0)
- self.assertEquals(resp_data['Errors'], [['c', '409 Conflict']])
- self.assertEquals(resp_data['Response Status'], '400 Bad Request')
- self.assertEquals([call(self.bulk.retry_interval),
- call(self.bulk.retry_interval ** 2),
- call(self.bulk.retry_interval ** 3)],
- mock_sleep.call_args_list)
+ self.assertEqual(resp_data['Number Deleted'], 0)
+ self.assertEqual(resp_data['Errors'], [['c', '409 Conflict']])
+ self.assertEqual(resp_data['Response Status'], '400 Bad Request')
+ self.assertEqual([call(self.bulk.retry_interval),
+ call(self.bulk.retry_interval ** 2),
+ call(self.bulk.retry_interval ** 3)],
+ mock_sleep.call_args_list)
def test_bulk_delete_container_delete_retry_and_success(self):
self.bulk.retry_count = 3
@@ -849,12 +849,12 @@ class TestDelete(unittest.TestCase):
return_value=None)) as mock_sleep:
resp_body = self.handle_delete_and_iter(req)
resp_data = utils.json.loads(resp_body)
- self.assertEquals(resp_data['Number Deleted'], 1)
- self.assertEquals(resp_data['Errors'], [])
- self.assertEquals(resp_data['Response Status'], '200 OK')
- self.assertEquals([call(self.bulk.retry_interval),
- call(self.bulk.retry_interval ** 2)],
- mock_sleep.call_args_list)
+ self.assertEqual(resp_data['Number Deleted'], 1)
+ self.assertEqual(resp_data['Errors'], [])
+ self.assertEqual(resp_data['Response Status'], '200 OK')
+ self.assertEqual([call(self.bulk.retry_interval),
+ call(self.bulk.retry_interval ** 2)],
+ mock_sleep.call_args_list)
def test_bulk_delete_bad_file_too_long(self):
req = Request.blank('/delete_works/AUTH_Acc',
@@ -866,9 +866,9 @@ class TestDelete(unittest.TestCase):
req.headers['Transfer-Encoding'] = 'chunked'
resp_body = self.handle_delete_and_iter(req)
resp_data = utils.json.loads(resp_body)
- self.assertEquals(resp_data['Number Deleted'], 2)
- self.assertEquals(resp_data['Errors'], [[bad_file, '400 Bad Request']])
- self.assertEquals(resp_data['Response Status'], '400 Bad Request')
+ self.assertEqual(resp_data['Number Deleted'], 2)
+ self.assertEqual(resp_data['Errors'], [[bad_file, '400 Bad Request']])
+ self.assertEqual(resp_data['Response Status'], '400 Bad Request')
def test_bulk_delete_bad_file_over_twice_max_length(self):
body = '/c/f\nc/' + ('123456' * self.bulk.max_path_length) + '\n'
@@ -883,14 +883,14 @@ class TestDelete(unittest.TestCase):
req.method = 'POST'
with patch.object(self.bulk, 'max_failed_deletes', 2):
resp_body = self.handle_delete_and_iter(req)
- self.assertEquals(self.app.calls, 2)
+ self.assertEqual(self.app.calls, 2)
resp_data = utils.json.loads(resp_body)
- self.assertEquals(resp_data['Response Status'], '400 Bad Request')
- self.assertEquals(resp_data['Response Body'],
- 'Max delete failures exceeded')
- self.assertEquals(resp_data['Errors'],
- [['/c/f1', '401 Unauthorized'],
- ['/c/f2', '401 Unauthorized']])
+ self.assertEqual(resp_data['Response Status'], '400 Bad Request')
+ self.assertEqual(resp_data['Response Body'],
+ 'Max delete failures exceeded')
+ self.assertEqual(resp_data['Errors'],
+ [['/c/f1', '401 Unauthorized'],
+ ['/c/f2', '401 Unauthorized']])
class TestSwiftInfo(unittest.TestCase):
diff --git a/test/unit/common/middleware/test_cname_lookup.py b/test/unit/common/middleware/test_cname_lookup.py
index ba76c5546d..51c1dc1b59 100644
--- a/test/unit/common/middleware/test_cname_lookup.py
+++ b/test/unit/common/middleware/test_cname_lookup.py
@@ -55,12 +55,12 @@ class TestCNAMELookup(unittest.TestCase):
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'},
headers={'Host': '10.134.23.198'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, 'FAKE APP')
+ self.assertEqual(resp, 'FAKE APP')
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'},
headers={'Host': 'fc00:7ea1:f155::6321:8841'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, 'FAKE APP')
+ self.assertEqual(resp, 'FAKE APP')
def test_passthrough(self):
@@ -71,16 +71,16 @@ class TestCNAMELookup(unittest.TestCase):
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'},
headers={'Host': 'foo.example.com'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, 'FAKE APP')
+ self.assertEqual(resp, 'FAKE APP')
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'},
headers={'Host': 'foo.example.com:8080'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, 'FAKE APP')
+ self.assertEqual(resp, 'FAKE APP')
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET',
'SERVER_NAME': 'foo.example.com'},
headers={'Host': None})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, 'FAKE APP')
+ self.assertEqual(resp, 'FAKE APP')
def test_good_lookup(self):
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'},
@@ -91,16 +91,16 @@ class TestCNAMELookup(unittest.TestCase):
cname_lookup.lookup_cname = my_lookup
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, 'FAKE APP')
+ self.assertEqual(resp, 'FAKE APP')
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'},
headers={'Host': 'mysite.com:8080'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, 'FAKE APP')
+ self.assertEqual(resp, 'FAKE APP')
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET',
'SERVER_NAME': 'mysite.com'},
headers={'Host': None})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, 'FAKE APP')
+ self.assertEqual(resp, 'FAKE APP')
def test_lookup_chain_too_long(self):
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'},
@@ -117,7 +117,7 @@ class TestCNAMELookup(unittest.TestCase):
cname_lookup.lookup_cname = my_lookup
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, ['CNAME lookup failed after 2 tries'])
+ self.assertEqual(resp, ['CNAME lookup failed after 2 tries'])
def test_lookup_chain_bad_target(self):
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'},
@@ -128,8 +128,8 @@ class TestCNAMELookup(unittest.TestCase):
cname_lookup.lookup_cname = my_lookup
resp = self.app(req.environ, start_response)
- self.assertEquals(resp,
- ['CNAME lookup failed to resolve to a valid domain'])
+ self.assertEqual(resp,
+ ['CNAME lookup failed to resolve to a valid domain'])
def test_something_weird(self):
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'},
@@ -140,8 +140,8 @@ class TestCNAMELookup(unittest.TestCase):
cname_lookup.lookup_cname = my_lookup
resp = self.app(req.environ, start_response)
- self.assertEquals(resp,
- ['CNAME lookup failed to resolve to a valid domain'])
+ self.assertEqual(resp,
+ ['CNAME lookup failed to resolve to a valid domain'])
def test_with_memcache(self):
def my_lookup(d):
@@ -162,12 +162,12 @@ class TestCNAMELookup(unittest.TestCase):
'swift.cache': memcache},
headers={'Host': 'mysite.com'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, 'FAKE APP')
+ self.assertEqual(resp, 'FAKE APP')
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET',
'swift.cache': memcache},
headers={'Host': 'mysite.com'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, 'FAKE APP')
+ self.assertEqual(resp, 'FAKE APP')
def test_cname_matching_ending_not_domain(self):
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'},
@@ -178,8 +178,8 @@ class TestCNAMELookup(unittest.TestCase):
cname_lookup.lookup_cname = my_lookup
resp = self.app(req.environ, start_response)
- self.assertEquals(resp,
- ['CNAME lookup failed to resolve to a valid domain'])
+ self.assertEqual(resp,
+ ['CNAME lookup failed to resolve to a valid domain'])
def test_cname_configured_with_empty_storage_domain(self):
app = cname_lookup.CNAMELookupMiddleware(FakeApp(),
@@ -193,28 +193,28 @@ class TestCNAMELookup(unittest.TestCase):
cname_lookup.lookup_cname = my_lookup
resp = app(req.environ, start_response)
- self.assertEquals(resp, 'FAKE APP')
+ self.assertEqual(resp, 'FAKE APP')
def test_storage_domains_conf_format(self):
conf = {'storage_domain': 'foo.com'}
app = cname_lookup.filter_factory(conf)(FakeApp())
- self.assertEquals(app.storage_domain, ['.foo.com'])
+ self.assertEqual(app.storage_domain, ['.foo.com'])
conf = {'storage_domain': 'foo.com, '}
app = cname_lookup.filter_factory(conf)(FakeApp())
- self.assertEquals(app.storage_domain, ['.foo.com'])
+ self.assertEqual(app.storage_domain, ['.foo.com'])
conf = {'storage_domain': 'foo.com, bar.com'}
app = cname_lookup.filter_factory(conf)(FakeApp())
- self.assertEquals(app.storage_domain, ['.foo.com', '.bar.com'])
+ self.assertEqual(app.storage_domain, ['.foo.com', '.bar.com'])
conf = {'storage_domain': 'foo.com, .bar.com'}
app = cname_lookup.filter_factory(conf)(FakeApp())
- self.assertEquals(app.storage_domain, ['.foo.com', '.bar.com'])
+ self.assertEqual(app.storage_domain, ['.foo.com', '.bar.com'])
conf = {'storage_domain': '.foo.com, .bar.com'}
app = cname_lookup.filter_factory(conf)(FakeApp())
- self.assertEquals(app.storage_domain, ['.foo.com', '.bar.com'])
+ self.assertEqual(app.storage_domain, ['.foo.com', '.bar.com'])
def test_multiple_storage_domains(self):
conf = {'storage_domain': 'storage1.com, storage2.com',
@@ -229,11 +229,11 @@ class TestCNAMELookup(unittest.TestCase):
return app(req.environ, start_response)
resp = do_test('c.storage1.com')
- self.assertEquals(resp, 'FAKE APP')
+ self.assertEqual(resp, 'FAKE APP')
resp = do_test('c.storage2.com')
- self.assertEquals(resp, 'FAKE APP')
+ self.assertEqual(resp, 'FAKE APP')
bad_domain = ['CNAME lookup failed to resolve to a valid domain']
resp = do_test('c.badtest.com')
- self.assertEquals(resp, bad_domain)
+ self.assertEqual(resp, bad_domain)
diff --git a/test/unit/common/middleware/test_crossdomain.py b/test/unit/common/middleware/test_crossdomain.py
index c5c0ca68e6..aa08c94cca 100644
--- a/test/unit/common/middleware/test_crossdomain.py
+++ b/test/unit/common/middleware/test_crossdomain.py
@@ -47,7 +47,7 @@ class TestCrossDomain(unittest.TestCase):
req = Request.blank('/crossdomain.xml',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, [expectedResponse])
+ self.assertEqual(resp, [expectedResponse])
# GET of /crossdomain.xml (custom)
def test_crossdomain_custom(self):
@@ -64,13 +64,13 @@ class TestCrossDomain(unittest.TestCase):
req = Request.blank('/crossdomain.xml',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, [expectedResponse])
+ self.assertEqual(resp, [expectedResponse])
# GET to a different resource should be passed on
def test_crossdomain_pass(self):
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, 'FAKE APP')
+ self.assertEqual(resp, 'FAKE APP')
# Only GET is allowed on the /crossdomain.xml resource
def test_crossdomain_get_only(self):
@@ -78,7 +78,7 @@ class TestCrossDomain(unittest.TestCase):
req = Request.blank('/crossdomain.xml',
environ={'REQUEST_METHOD': method})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, 'FAKE APP')
+ self.assertEqual(resp, 'FAKE APP')
if __name__ == '__main__':
diff --git a/test/unit/common/middleware/test_domain_remap.py b/test/unit/common/middleware/test_domain_remap.py
index 225e947a76..d02327ddfd 100644
--- a/test/unit/common/middleware/test_domain_remap.py
+++ b/test/unit/common/middleware/test_domain_remap.py
@@ -40,72 +40,72 @@ class TestDomainRemap(unittest.TestCase):
'SERVER_NAME': 'example.com'},
headers={'Host': None})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, '/')
+ self.assertEqual(resp, '/')
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'},
headers={'Host': 'example.com'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, '/')
+ self.assertEqual(resp, '/')
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'},
headers={'Host': 'example.com:8080'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, '/')
+ self.assertEqual(resp, '/')
def test_domain_remap_account(self):
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET',
'SERVER_NAME': 'AUTH_a.example.com'},
headers={'Host': None})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, '/v1/AUTH_a')
+ self.assertEqual(resp, '/v1/AUTH_a')
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'},
headers={'Host': 'AUTH_a.example.com'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, '/v1/AUTH_a')
+ self.assertEqual(resp, '/v1/AUTH_a')
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'},
headers={'Host': 'AUTH-uuid.example.com'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, '/v1/AUTH_uuid')
+ self.assertEqual(resp, '/v1/AUTH_uuid')
def test_domain_remap_account_container(self):
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'},
headers={'Host': 'c.AUTH_a.example.com'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, '/v1/AUTH_a/c')
+ self.assertEqual(resp, '/v1/AUTH_a/c')
def test_domain_remap_extra_subdomains(self):
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'},
headers={'Host': 'x.y.c.AUTH_a.example.com'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, ['Bad domain in host header'])
+ self.assertEqual(resp, ['Bad domain in host header'])
def test_domain_remap_account_with_path_root(self):
req = Request.blank('/v1', environ={'REQUEST_METHOD': 'GET'},
headers={'Host': 'AUTH_a.example.com'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, '/v1/AUTH_a')
+ self.assertEqual(resp, '/v1/AUTH_a')
def test_domain_remap_account_container_with_path_root(self):
req = Request.blank('/v1', environ={'REQUEST_METHOD': 'GET'},
headers={'Host': 'c.AUTH_a.example.com'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, '/v1/AUTH_a/c')
+ self.assertEqual(resp, '/v1/AUTH_a/c')
def test_domain_remap_account_container_with_path(self):
req = Request.blank('/obj', environ={'REQUEST_METHOD': 'GET'},
headers={'Host': 'c.AUTH_a.example.com'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, '/v1/AUTH_a/c/obj')
+ self.assertEqual(resp, '/v1/AUTH_a/c/obj')
def test_domain_remap_account_container_with_path_root_and_path(self):
req = Request.blank('/v1/obj', environ={'REQUEST_METHOD': 'GET'},
headers={'Host': 'c.AUTH_a.example.com'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, '/v1/AUTH_a/c/obj')
+ self.assertEqual(resp, '/v1/AUTH_a/c/obj')
def test_domain_remap_account_matching_ending_not_domain(self):
req = Request.blank('/dontchange', environ={'REQUEST_METHOD': 'GET'},
headers={'Host': 'c.aexample.com'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, '/dontchange')
+ self.assertEqual(resp, '/dontchange')
def test_domain_remap_configured_with_empty_storage_domain(self):
self.app = domain_remap.DomainRemapMiddleware(FakeApp(),
@@ -113,7 +113,7 @@ class TestDomainRemap(unittest.TestCase):
req = Request.blank('/test', environ={'REQUEST_METHOD': 'GET'},
headers={'Host': 'c.AUTH_a.example.com'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, '/test')
+ self.assertEqual(resp, '/test')
def test_domain_remap_configured_with_prefixes(self):
conf = {'reseller_prefixes': 'PREFIX'}
@@ -121,7 +121,7 @@ class TestDomainRemap(unittest.TestCase):
req = Request.blank('/test', environ={'REQUEST_METHOD': 'GET'},
headers={'Host': 'c.prefix_uuid.example.com'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, '/v1/PREFIX_uuid/c/test')
+ self.assertEqual(resp, '/v1/PREFIX_uuid/c/test')
def test_domain_remap_configured_with_bad_prefixes(self):
conf = {'reseller_prefixes': 'UNKNOWN'}
@@ -129,7 +129,7 @@ class TestDomainRemap(unittest.TestCase):
req = Request.blank('/test', environ={'REQUEST_METHOD': 'GET'},
headers={'Host': 'c.prefix_uuid.example.com'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, '/test')
+ self.assertEqual(resp, '/test')
def test_domain_remap_configured_with_no_prefixes(self):
conf = {'reseller_prefixes': ''}
@@ -137,7 +137,7 @@ class TestDomainRemap(unittest.TestCase):
req = Request.blank('/test', environ={'REQUEST_METHOD': 'GET'},
headers={'Host': 'c.uuid.example.com'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, '/v1/uuid/c/test')
+ self.assertEqual(resp, '/v1/uuid/c/test')
def test_domain_remap_add_prefix(self):
conf = {'default_reseller_prefix': 'FOO'}
@@ -145,7 +145,7 @@ class TestDomainRemap(unittest.TestCase):
req = Request.blank('/test', environ={'REQUEST_METHOD': 'GET'},
headers={'Host': 'uuid.example.com'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, '/v1/FOO_uuid/test')
+ self.assertEqual(resp, '/v1/FOO_uuid/test')
def test_domain_remap_add_prefix_already_there(self):
conf = {'default_reseller_prefix': 'AUTH'}
@@ -153,7 +153,7 @@ class TestDomainRemap(unittest.TestCase):
req = Request.blank('/test', environ={'REQUEST_METHOD': 'GET'},
headers={'Host': 'auth-uuid.example.com'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, '/v1/AUTH_uuid/test')
+ self.assertEqual(resp, '/v1/AUTH_uuid/test')
class TestSwiftInfo(unittest.TestCase):
@@ -172,7 +172,7 @@ class TestSwiftInfo(unittest.TestCase):
domain_remap.filter_factory({'default_reseller_prefix': 'cupcake'})
swift_info = utils.get_swift_info()
self.assertTrue('domain_remap' in swift_info)
- self.assertEquals(
+ self.assertEqual(
swift_info['domain_remap'].get('default_reseller_prefix'),
'cupcake')
diff --git a/test/unit/common/middleware/test_except.py b/test/unit/common/middleware/test_except.py
index dd2dd667ab..494887224c 100644
--- a/test/unit/common/middleware/test_except.py
+++ b/test/unit/common/middleware/test_except.py
@@ -57,43 +57,43 @@ class TestCatchErrors(unittest.TestCase):
app = catch_errors.CatchErrorMiddleware(FakeApp(), {})
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'})
resp = app(req.environ, start_response)
- self.assertEquals(list(resp), ['FAKE APP'])
+ self.assertEqual(list(resp), ['FAKE APP'])
def test_catcherrors(self):
app = catch_errors.CatchErrorMiddleware(FakeApp(True), {})
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'})
resp = app(req.environ, start_response)
- self.assertEquals(list(resp), ['An error occurred'])
+ self.assertEqual(list(resp), ['An error occurred'])
def test_trans_id_header_pass(self):
- self.assertEquals(self.logger.txn_id, None)
+ self.assertEqual(self.logger.txn_id, None)
def start_response(status, headers, exc_info=None):
self.assertTrue('X-Trans-Id' in (x[0] for x in headers))
app = catch_errors.CatchErrorMiddleware(FakeApp(), {})
req = Request.blank('/v1/a/c/o')
app(req.environ, start_response)
- self.assertEquals(len(self.logger.txn_id), 34) # 32 hex + 'tx'
+ self.assertEqual(len(self.logger.txn_id), 34) # 32 hex + 'tx'
def test_trans_id_header_fail(self):
- self.assertEquals(self.logger.txn_id, None)
+ self.assertEqual(self.logger.txn_id, None)
def start_response(status, headers, exc_info=None):
self.assertTrue('X-Trans-Id' in (x[0] for x in headers))
app = catch_errors.CatchErrorMiddleware(FakeApp(True), {})
req = Request.blank('/v1/a/c/o')
app(req.environ, start_response)
- self.assertEquals(len(self.logger.txn_id), 34)
+ self.assertEqual(len(self.logger.txn_id), 34)
def test_error_in_iterator(self):
app = catch_errors.CatchErrorMiddleware(
FakeApp(body_iter=(int(x) for x in 'abcd')), {})
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'})
resp = app(req.environ, start_response)
- self.assertEquals(list(resp), ['An error occurred'])
+ self.assertEqual(list(resp), ['An error occurred'])
def test_trans_id_header_suffix(self):
- self.assertEquals(self.logger.txn_id, None)
+ self.assertEqual(self.logger.txn_id, None)
def start_response(status, headers, exc_info=None):
self.assertTrue('X-Trans-Id' in (x[0] for x in headers))
@@ -104,7 +104,7 @@ class TestCatchErrors(unittest.TestCase):
self.assertTrue(self.logger.txn_id.endswith('-stuff'))
def test_trans_id_header_extra(self):
- self.assertEquals(self.logger.txn_id, None)
+ self.assertEqual(self.logger.txn_id, None)
def start_response(status, headers, exc_info=None):
self.assertTrue('X-Trans-Id' in (x[0] for x in headers))
@@ -116,7 +116,7 @@ class TestCatchErrors(unittest.TestCase):
self.assertTrue(self.logger.txn_id.endswith('-fromconf-fromuser'))
def test_trans_id_header_extra_length_limit(self):
- self.assertEquals(self.logger.txn_id, None)
+ self.assertEqual(self.logger.txn_id, None)
def start_response(status, headers, exc_info=None):
self.assertTrue('X-Trans-Id' in (x[0] for x in headers))
@@ -129,7 +129,7 @@ class TestCatchErrors(unittest.TestCase):
'-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'))
def test_trans_id_header_extra_quoted(self):
- self.assertEquals(self.logger.txn_id, None)
+ self.assertEqual(self.logger.txn_id, None)
def start_response(status, headers, exc_info=None):
self.assertTrue('X-Trans-Id' in (x[0] for x in headers))
@@ -143,7 +143,7 @@ class TestCatchErrors(unittest.TestCase):
app = catch_errors.CatchErrorMiddleware(FakeApp(error='strange'), {})
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'})
resp = app(req.environ, start_response)
- self.assertEquals(list(resp), ['An error occurred'])
+ self.assertEqual(list(resp), ['An error occurred'])
if __name__ == '__main__':
diff --git a/test/unit/common/middleware/test_formpost.py b/test/unit/common/middleware/test_formpost.py
index 6b7ecead17..4e6f24826f 100644
--- a/test/unit/common/middleware/test_formpost.py
+++ b/test/unit/common/middleware/test_formpost.py
@@ -73,7 +73,7 @@ class FakeApp(object):
class TestCappedFileLikeObject(unittest.TestCase):
def test_whole(self):
- self.assertEquals(
+ self.assertEqual(
formpost._CappedFileLikeObject(BytesIO(b'abc'), 10).read(),
b'abc')
@@ -83,31 +83,31 @@ class TestCappedFileLikeObject(unittest.TestCase):
formpost._CappedFileLikeObject(BytesIO(b'abc'), 2).read()
except EOFError as err:
exc = err
- self.assertEquals(str(exc), 'max_file_size exceeded')
+ self.assertEqual(str(exc), 'max_file_size exceeded')
def test_whole_readline(self):
fp = formpost._CappedFileLikeObject(BytesIO(b'abc\ndef'), 10)
- self.assertEquals(fp.readline(), b'abc\n')
- self.assertEquals(fp.readline(), b'def')
- self.assertEquals(fp.readline(), b'')
+ self.assertEqual(fp.readline(), b'abc\n')
+ self.assertEqual(fp.readline(), b'def')
+ self.assertEqual(fp.readline(), b'')
def test_exceeded_readline(self):
fp = formpost._CappedFileLikeObject(BytesIO(b'abc\ndef'), 5)
- self.assertEquals(fp.readline(), b'abc\n')
+ self.assertEqual(fp.readline(), b'abc\n')
exc = None
try:
- self.assertEquals(fp.readline(), b'def')
+ self.assertEqual(fp.readline(), b'def')
except EOFError as err:
exc = err
- self.assertEquals(str(exc), 'max_file_size exceeded')
+ self.assertEqual(str(exc), 'max_file_size exceeded')
def test_read_sized(self):
fp = formpost._CappedFileLikeObject(BytesIO(b'abcdefg'), 10)
- self.assertEquals(fp.read(2), b'ab')
- self.assertEquals(fp.read(2), b'cd')
- self.assertEquals(fp.read(2), b'ef')
- self.assertEquals(fp.read(2), b'g')
- self.assertEquals(fp.read(2), b'')
+ self.assertEqual(fp.read(2), b'ab')
+ self.assertEqual(fp.read(2), b'cd')
+ self.assertEqual(fp.read(2), b'ef')
+ self.assertEqual(fp.read(2), b'g')
+ self.assertEqual(fp.read(2), b'')
class TestFormPost(unittest.TestCase):
@@ -238,7 +238,7 @@ class TestFormPost(unittest.TestCase):
resp = self._make_request(
'/v1/a/c/o',
environ={'REQUEST_METHOD': method}).get_response(self.formpost)
- self.assertEquals(resp.status_int, 401)
+ self.assertEqual(resp.status_int, 401)
self.assertTrue('FormPost' not in resp.body)
def test_auth_scheme(self):
@@ -266,13 +266,13 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '401 Unauthorized')
+ self.assertEqual(status, '401 Unauthorized')
authenticate_v = None
for h, v in headers:
if h.lower() == 'www-authenticate':
authenticate_v = v
self.assertTrue('FormPost: Form Expired' in body)
- self.assertEquals('Swift realm="unknown"', authenticate_v)
+ self.assertEqual('Swift realm="unknown"', authenticate_v)
def test_safari(self):
key = 'abc'
@@ -379,17 +379,17 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '303 See Other')
+ self.assertEqual(status, '303 See Other')
location = None
for h, v in headers:
if h.lower() == 'location':
location = v
- self.assertEquals(location, 'http://brim.net?status=201&message=')
- self.assertEquals(exc_info, None)
+ self.assertEqual(location, 'http://brim.net?status=201&message=')
+ self.assertEqual(exc_info, None)
self.assertTrue('http://brim.net?status=201&message=' in body)
- self.assertEquals(len(self.app.requests), 2)
- self.assertEquals(self.app.requests[0].body, 'Test File\nOne\n')
- self.assertEquals(self.app.requests[1].body, 'Test\nFile\nTwo\n')
+ self.assertEqual(len(self.app.requests), 2)
+ self.assertEqual(self.app.requests[0].body, 'Test File\nOne\n')
+ self.assertEqual(self.app.requests[1].body, 'Test\nFile\nTwo\n')
def test_firefox(self):
key = 'abc'
@@ -495,17 +495,17 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '303 See Other')
+ self.assertEqual(status, '303 See Other')
location = None
for h, v in headers:
if h.lower() == 'location':
location = v
- self.assertEquals(location, 'http://brim.net?status=201&message=')
- self.assertEquals(exc_info, None)
+ self.assertEqual(location, 'http://brim.net?status=201&message=')
+ self.assertEqual(exc_info, None)
self.assertTrue('http://brim.net?status=201&message=' in body)
- self.assertEquals(len(self.app.requests), 2)
- self.assertEquals(self.app.requests[0].body, 'Test File\nOne\n')
- self.assertEquals(self.app.requests[1].body, 'Test\nFile\nTwo\n')
+ self.assertEqual(len(self.app.requests), 2)
+ self.assertEqual(self.app.requests[0].body, 'Test File\nOne\n')
+ self.assertEqual(self.app.requests[1].body, 'Test\nFile\nTwo\n')
def test_chrome(self):
key = 'abc'
@@ -614,17 +614,17 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '303 See Other')
+ self.assertEqual(status, '303 See Other')
location = None
for h, v in headers:
if h.lower() == 'location':
location = v
- self.assertEquals(location, 'http://brim.net?status=201&message=')
- self.assertEquals(exc_info, None)
+ self.assertEqual(location, 'http://brim.net?status=201&message=')
+ self.assertEqual(exc_info, None)
self.assertTrue('http://brim.net?status=201&message=' in body)
- self.assertEquals(len(self.app.requests), 2)
- self.assertEquals(self.app.requests[0].body, 'Test File\nOne\n')
- self.assertEquals(self.app.requests[1].body, 'Test\nFile\nTwo\n')
+ self.assertEqual(len(self.app.requests), 2)
+ self.assertEqual(self.app.requests[0].body, 'Test File\nOne\n')
+ self.assertEqual(self.app.requests[1].body, 'Test\nFile\nTwo\n')
def test_explorer(self):
key = 'abc'
@@ -729,17 +729,17 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '303 See Other')
+ self.assertEqual(status, '303 See Other')
location = None
for h, v in headers:
if h.lower() == 'location':
location = v
- self.assertEquals(location, 'http://brim.net?status=201&message=')
- self.assertEquals(exc_info, None)
+ self.assertEqual(location, 'http://brim.net?status=201&message=')
+ self.assertEqual(exc_info, None)
self.assertTrue('http://brim.net?status=201&message=' in body)
- self.assertEquals(len(self.app.requests), 2)
- self.assertEquals(self.app.requests[0].body, 'Test File\nOne\n')
- self.assertEquals(self.app.requests[1].body, 'Test\nFile\nTwo\n')
+ self.assertEqual(len(self.app.requests), 2)
+ self.assertEqual(self.app.requests[0].body, 'Test File\nOne\n')
+ self.assertEqual(self.app.requests[1].body, 'Test\nFile\nTwo\n')
def test_messed_up_start(self):
key = 'abc'
@@ -772,10 +772,10 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '400 Bad Request')
- self.assertEquals(exc_info, None)
+ self.assertEqual(status, '400 Bad Request')
+ self.assertEqual(exc_info, None)
self.assertTrue('FormPost: invalid starting boundary' in body)
- self.assertEquals(len(self.app.requests), 0)
+ self.assertEqual(len(self.app.requests), 0)
def test_max_file_size_exceeded(self):
key = 'abc'
@@ -803,10 +803,10 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '400 Bad Request')
- self.assertEquals(exc_info, None)
+ self.assertEqual(status, '400 Bad Request')
+ self.assertEqual(exc_info, None)
self.assertTrue('FormPost: max_file_size exceeded' in body)
- self.assertEquals(len(self.app.requests), 0)
+ self.assertEqual(len(self.app.requests), 0)
def test_max_file_count_exceeded(self):
key = 'abc'
@@ -834,20 +834,20 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '303 See Other')
+ self.assertEqual(status, '303 See Other')
location = None
for h, v in headers:
if h.lower() == 'location':
location = v
- self.assertEquals(
+ self.assertEqual(
location,
'http://brim.net?status=400&message=max%20file%20count%20exceeded')
- self.assertEquals(exc_info, None)
+ self.assertEqual(exc_info, None)
self.assertTrue(
'http://brim.net?status=400&message=max%20file%20count%20exceeded'
in body)
- self.assertEquals(len(self.app.requests), 1)
- self.assertEquals(self.app.requests[0].body, 'Test File\nOne\n')
+ self.assertEqual(len(self.app.requests), 1)
+ self.assertEqual(self.app.requests[0].body, 'Test File\nOne\n')
def test_subrequest_does_not_pass_query(self):
key = 'abc'
@@ -879,10 +879,10 @@ class TestFormPost(unittest.TestCase):
exc_info = exc_info[0]
# Make sure we 201 Created, which means we made the final subrequest
# (and FakeApp verifies that no QUERY_STRING got passed).
- self.assertEquals(status, '201 Created')
- self.assertEquals(exc_info, None)
+ self.assertEqual(status, '201 Created')
+ self.assertEqual(exc_info, None)
self.assertTrue('201 Created' in body)
- self.assertEquals(len(self.app.requests), 2)
+ self.assertEqual(len(self.app.requests), 2)
def test_subrequest_fails(self):
key = 'abc'
@@ -910,15 +910,15 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '303 See Other')
+ self.assertEqual(status, '303 See Other')
location = None
for h, v in headers:
if h.lower() == 'location':
location = v
- self.assertEquals(location, 'http://brim.net?status=404&message=')
- self.assertEquals(exc_info, None)
+ self.assertEqual(location, 'http://brim.net?status=404&message=')
+ self.assertEqual(exc_info, None)
self.assertTrue('http://brim.net?status=404&message=' in body)
- self.assertEquals(len(self.app.requests), 1)
+ self.assertEqual(len(self.app.requests), 1)
def test_truncated_attr_value(self):
key = 'abc'
@@ -996,20 +996,20 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '303 See Other')
+ self.assertEqual(status, '303 See Other')
location = None
for h, v in headers:
if h.lower() == 'location':
location = v
- self.assertEquals(
+ self.assertEqual(
location,
('a' * formpost.MAX_VALUE_LENGTH) + '?status=201&message=')
- self.assertEquals(exc_info, None)
+ self.assertEqual(exc_info, None)
self.assertTrue(
('a' * formpost.MAX_VALUE_LENGTH) + '?status=201&message=' in body)
- self.assertEquals(len(self.app.requests), 2)
- self.assertEquals(self.app.requests[0].body, 'Test File\nOne\n')
- self.assertEquals(self.app.requests[1].body, 'Test\nFile\nTwo\n')
+ self.assertEqual(len(self.app.requests), 2)
+ self.assertEqual(self.app.requests[0].body, 'Test File\nOne\n')
+ self.assertEqual(self.app.requests[1].body, 'Test\nFile\nTwo\n')
def test_no_file_to_process(self):
key = 'abc'
@@ -1067,19 +1067,19 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '303 See Other')
+ self.assertEqual(status, '303 See Other')
location = None
for h, v in headers:
if h.lower() == 'location':
location = v
- self.assertEquals(
+ self.assertEqual(
location,
'http://brim.net?status=400&message=no%20files%20to%20process')
- self.assertEquals(exc_info, None)
+ self.assertEqual(exc_info, None)
self.assertTrue(
'http://brim.net?status=400&message=no%20files%20to%20process'
in body)
- self.assertEquals(len(self.app.requests), 0)
+ self.assertEqual(len(self.app.requests), 0)
def test_formpost_without_useragent(self):
key = 'abc'
@@ -1099,8 +1099,8 @@ class TestFormPost(unittest.TestCase):
pass
body = ''.join(self.formpost(env, start_response))
self.assertTrue('User-Agent' in self.app.requests[0].headers)
- self.assertEquals(self.app.requests[0].headers['User-Agent'],
- 'FormPost')
+ self.assertEqual(self.app.requests[0].headers['User-Agent'],
+ 'FormPost')
def test_formpost_with_origin(self):
key = 'abc'
@@ -1127,8 +1127,8 @@ class TestFormPost(unittest.TestCase):
pass
body = ''.join(self.formpost(env, start_response))
- self.assertEquals(headers['Access-Control-Allow-Origin'],
- 'http://localhost:5000')
+ self.assertEqual(headers['Access-Control-Allow-Origin'],
+ 'http://localhost:5000')
def test_formpost_with_multiple_keys(self):
key = 'ernie'
@@ -1219,17 +1219,17 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '303 See Other')
+ self.assertEqual(status, '303 See Other')
location = None
for h, v in headers:
if h.lower() == 'location':
location = v
- self.assertEquals(location, 'http://redirect?status=201&message=')
- self.assertEquals(exc_info, None)
+ self.assertEqual(location, 'http://redirect?status=201&message=')
+ self.assertEqual(exc_info, None)
self.assertTrue(location in body)
- self.assertEquals(len(self.app.requests), 2)
- self.assertEquals(self.app.requests[0].body, 'Test File\nOne\n')
- self.assertEquals(self.app.requests[1].body, 'Test\nFile\nTwo\n')
+ self.assertEqual(len(self.app.requests), 2)
+ self.assertEqual(self.app.requests[0].body, 'Test File\nOne\n')
+ self.assertEqual(self.app.requests[1].body, 'Test\nFile\nTwo\n')
def test_redirect_with_query(self):
key = 'abc'
@@ -1257,18 +1257,18 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '303 See Other')
+ self.assertEqual(status, '303 See Other')
location = None
for h, v in headers:
if h.lower() == 'location':
location = v
- self.assertEquals(location,
- 'http://redirect?one=two&status=201&message=')
- self.assertEquals(exc_info, None)
+ self.assertEqual(location,
+ 'http://redirect?one=two&status=201&message=')
+ self.assertEqual(exc_info, None)
self.assertTrue(location in body)
- self.assertEquals(len(self.app.requests), 2)
- self.assertEquals(self.app.requests[0].body, 'Test File\nOne\n')
- self.assertEquals(self.app.requests[1].body, 'Test\nFile\nTwo\n')
+ self.assertEqual(len(self.app.requests), 2)
+ self.assertEqual(self.app.requests[0].body, 'Test File\nOne\n')
+ self.assertEqual(self.app.requests[1].body, 'Test\nFile\nTwo\n')
def test_no_redirect(self):
key = 'abc'
@@ -1295,17 +1295,17 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '201 Created')
+ self.assertEqual(status, '201 Created')
location = None
for h, v in headers:
if h.lower() == 'location':
location = v
- self.assertEquals(location, None)
- self.assertEquals(exc_info, None)
+ self.assertEqual(location, None)
+ self.assertEqual(exc_info, None)
self.assertTrue('201 Created' in body)
- self.assertEquals(len(self.app.requests), 2)
- self.assertEquals(self.app.requests[0].body, 'Test File\nOne\n')
- self.assertEquals(self.app.requests[1].body, 'Test\nFile\nTwo\n')
+ self.assertEqual(len(self.app.requests), 2)
+ self.assertEqual(self.app.requests[0].body, 'Test File\nOne\n')
+ self.assertEqual(self.app.requests[1].body, 'Test\nFile\nTwo\n')
def test_no_redirect_expired(self):
key = 'abc'
@@ -1331,13 +1331,13 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '401 Unauthorized')
+ self.assertEqual(status, '401 Unauthorized')
location = None
for h, v in headers:
if h.lower() == 'location':
location = v
- self.assertEquals(location, None)
- self.assertEquals(exc_info, None)
+ self.assertEqual(location, None)
+ self.assertEqual(exc_info, None)
self.assertTrue('FormPost: Form Expired' in body)
def test_no_redirect_invalid_sig(self):
@@ -1365,13 +1365,13 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '401 Unauthorized')
+ self.assertEqual(status, '401 Unauthorized')
location = None
for h, v in headers:
if h.lower() == 'location':
location = v
- self.assertEquals(location, None)
- self.assertEquals(exc_info, None)
+ self.assertEqual(location, None)
+ self.assertEqual(exc_info, None)
self.assertTrue('FormPost: Invalid Signature' in body)
def test_no_redirect_with_error(self):
@@ -1398,13 +1398,13 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '400 Bad Request')
+ self.assertEqual(status, '400 Bad Request')
location = None
for h, v in headers:
if h.lower() == 'location':
location = v
- self.assertEquals(location, None)
- self.assertEquals(exc_info, None)
+ self.assertEqual(location, None)
+ self.assertEqual(exc_info, None)
self.assertTrue('FormPost: invalid starting boundary' in body)
def test_no_v1(self):
@@ -1431,13 +1431,13 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '401 Unauthorized')
+ self.assertEqual(status, '401 Unauthorized')
location = None
for h, v in headers:
if h.lower() == 'location':
location = v
- self.assertEquals(location, None)
- self.assertEquals(exc_info, None)
+ self.assertEqual(location, None)
+ self.assertEqual(exc_info, None)
self.assertTrue('FormPost: Invalid Signature' in body)
def test_empty_v1(self):
@@ -1464,13 +1464,13 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '401 Unauthorized')
+ self.assertEqual(status, '401 Unauthorized')
location = None
for h, v in headers:
if h.lower() == 'location':
location = v
- self.assertEquals(location, None)
- self.assertEquals(exc_info, None)
+ self.assertEqual(location, None)
+ self.assertEqual(exc_info, None)
self.assertTrue('FormPost: Invalid Signature' in body)
def test_empty_account(self):
@@ -1497,13 +1497,13 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '401 Unauthorized')
+ self.assertEqual(status, '401 Unauthorized')
location = None
for h, v in headers:
if h.lower() == 'location':
location = v
- self.assertEquals(location, None)
- self.assertEquals(exc_info, None)
+ self.assertEqual(location, None)
+ self.assertEqual(exc_info, None)
self.assertTrue('FormPost: Invalid Signature' in body)
def test_wrong_account(self):
@@ -1532,13 +1532,13 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '401 Unauthorized')
+ self.assertEqual(status, '401 Unauthorized')
location = None
for h, v in headers:
if h.lower() == 'location':
location = v
- self.assertEquals(location, None)
- self.assertEquals(exc_info, None)
+ self.assertEqual(location, None)
+ self.assertEqual(exc_info, None)
self.assertTrue('FormPost: Invalid Signature' in body)
def test_no_container(self):
@@ -1565,13 +1565,13 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '401 Unauthorized')
+ self.assertEqual(status, '401 Unauthorized')
location = None
for h, v in headers:
if h.lower() == 'location':
location = v
- self.assertEquals(location, None)
- self.assertEquals(exc_info, None)
+ self.assertEqual(location, None)
+ self.assertEqual(exc_info, None)
self.assertTrue('FormPost: Invalid Signature' in body)
def test_completely_non_int_expires(self):
@@ -1603,13 +1603,13 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '400 Bad Request')
+ self.assertEqual(status, '400 Bad Request')
location = None
for h, v in headers:
if h.lower() == 'location':
location = v
- self.assertEquals(location, None)
- self.assertEquals(exc_info, None)
+ self.assertEqual(location, None)
+ self.assertEqual(exc_info, None)
self.assertTrue('FormPost: expired not an integer' in body)
def test_x_delete_at(self):
@@ -1645,15 +1645,15 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '201 Created')
+ self.assertEqual(status, '201 Created')
self.assertTrue('201 Created' in body)
- self.assertEquals(len(self.app.requests), 2)
+ self.assertEqual(len(self.app.requests), 2)
self.assertTrue("X-Delete-At" in self.app.requests[0].headers)
self.assertTrue("X-Delete-At" in self.app.requests[1].headers)
- self.assertEquals(delete_at,
- self.app.requests[0].headers["X-Delete-At"])
- self.assertEquals(delete_at,
- self.app.requests[1].headers["X-Delete-At"])
+ self.assertEqual(delete_at,
+ self.app.requests[0].headers["X-Delete-At"])
+ self.assertEqual(delete_at,
+ self.app.requests[1].headers["X-Delete-At"])
def test_x_delete_at_not_int(self):
delete_at = "2014-07-16"
@@ -1687,7 +1687,7 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '400 Bad Request')
+ self.assertEqual(status, '400 Bad Request')
self.assertTrue('FormPost: x_delete_at not an integer' in body)
def test_x_delete_after(self):
@@ -1723,9 +1723,9 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '201 Created')
+ self.assertEqual(status, '201 Created')
self.assertTrue('201 Created' in body)
- self.assertEquals(len(self.app.requests), 2)
+ self.assertEqual(len(self.app.requests), 2)
self.assertTrue("X-Delete-After" in self.app.requests[0].headers)
self.assertTrue("X-Delete-After" in self.app.requests[1].headers)
self.assertEqual(delete_after,
@@ -1765,7 +1765,7 @@ class TestFormPost(unittest.TestCase):
status = status[0]
headers = headers[0]
exc_info = exc_info[0]
- self.assertEquals(status, '400 Bad Request')
+ self.assertEqual(status, '400 Bad Request')
self.assertTrue('FormPost: x_delete_after not an integer' in body)
diff --git a/test/unit/common/middleware/test_gatekeeper.py b/test/unit/common/middleware/test_gatekeeper.py
index e4109b0c3d..42d88e6abd 100644
--- a/test/unit/common/middleware/test_gatekeeper.py
+++ b/test/unit/common/middleware/test_gatekeeper.py
@@ -99,8 +99,8 @@ class TestGatekeeper(unittest.TestCase):
fake_app = FakeApp()
app = self.get_app(fake_app, {})
resp = req.get_response(app)
- self.assertEquals('200 OK', resp.status)
- self.assertEquals(resp.body, 'FAKE APP')
+ self.assertEqual('200 OK', resp.status)
+ self.assertEqual(resp.body, 'FAKE APP')
self._assertHeadersEqual(self.allowed_headers, fake_app.req.headers)
def _test_reserved_header_removed_inbound(self, method):
@@ -111,7 +111,7 @@ class TestGatekeeper(unittest.TestCase):
fake_app = FakeApp()
app = self.get_app(fake_app, {})
resp = req.get_response(app)
- self.assertEquals('200 OK', resp.status)
+ self.assertEqual('200 OK', resp.status)
self._assertHeadersEqual(self.allowed_headers, fake_app.req.headers)
self._assertHeadersAbsent(self.forbidden_headers_in,
fake_app.req.headers)
@@ -127,7 +127,7 @@ class TestGatekeeper(unittest.TestCase):
fake_app = FakeApp(headers=headers)
app = self.get_app(fake_app, {})
resp = req.get_response(app)
- self.assertEquals('200 OK', resp.status)
+ self.assertEqual('200 OK', resp.status)
self._assertHeadersEqual(self.allowed_headers, resp.headers)
self._assertHeadersAbsent(self.forbidden_headers_out, resp.headers)
diff --git a/test/unit/common/middleware/test_healthcheck.py b/test/unit/common/middleware/test_healthcheck.py
index 2cd6faf79e..3f95c6b2a8 100644
--- a/test/unit/common/middleware/test_healthcheck.py
+++ b/test/unit/common/middleware/test_healthcheck.py
@@ -50,30 +50,30 @@ class TestHealthCheck(unittest.TestCase):
req = Request.blank('/healthcheck', environ={'REQUEST_METHOD': 'GET'})
app = self.get_app(FakeApp(), {})
resp = app(req.environ, self.start_response)
- self.assertEquals(['200 OK'], self.got_statuses)
- self.assertEquals(resp, ['OK'])
+ self.assertEqual(['200 OK'], self.got_statuses)
+ self.assertEqual(resp, ['OK'])
def test_healtcheck_pass(self):
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'})
app = self.get_app(FakeApp(), {})
resp = app(req.environ, self.start_response)
- self.assertEquals(['200 OK'], self.got_statuses)
- self.assertEquals(resp, ['FAKE APP'])
+ self.assertEqual(['200 OK'], self.got_statuses)
+ self.assertEqual(resp, ['FAKE APP'])
def test_healthcheck_pass_not_disabled(self):
req = Request.blank('/healthcheck', environ={'REQUEST_METHOD': 'GET'})
app = self.get_app(FakeApp(), {}, disable_path=self.disable_path)
resp = app(req.environ, self.start_response)
- self.assertEquals(['200 OK'], self.got_statuses)
- self.assertEquals(resp, ['OK'])
+ self.assertEqual(['200 OK'], self.got_statuses)
+ self.assertEqual(resp, ['OK'])
def test_healthcheck_pass_disabled(self):
open(self.disable_path, 'w')
req = Request.blank('/healthcheck', environ={'REQUEST_METHOD': 'GET'})
app = self.get_app(FakeApp(), {}, disable_path=self.disable_path)
resp = app(req.environ, self.start_response)
- self.assertEquals(['503 Service Unavailable'], self.got_statuses)
- self.assertEquals(resp, ['DISABLED BY FILE'])
+ self.assertEqual(['503 Service Unavailable'], self.got_statuses)
+ self.assertEqual(resp, ['DISABLED BY FILE'])
if __name__ == '__main__':
diff --git a/test/unit/common/middleware/test_keystoneauth.py b/test/unit/common/middleware/test_keystoneauth.py
index da9530a063..24dd1a0d8d 100644
--- a/test/unit/common/middleware/test_keystoneauth.py
+++ b/test/unit/common/middleware/test_keystoneauth.py
@@ -205,7 +205,7 @@ class SwiftAuth(unittest.TestCase):
req = self._make_request('/v1/AUTH_account',
environ={'swift.authorize_override': True})
resp = req.get_response(self.test_auth)
- self.assertEquals(resp.status_int, 401)
+ self.assertEqual(resp.status_int, 401)
def test_override_asked_for_and_allowed(self):
conf = {'allow_overrides': 'true'}
@@ -213,13 +213,13 @@ class SwiftAuth(unittest.TestCase):
req = self._make_request('/v1/AUTH_account',
environ={'swift.authorize_override': True})
resp = req.get_response(self.test_auth)
- self.assertEquals(resp.status_int, 404)
+ self.assertEqual(resp.status_int, 404)
def test_override_default_allowed(self):
req = self._make_request('/v1/AUTH_account',
environ={'swift.authorize_override': True})
resp = req.get_response(self.test_auth)
- self.assertEquals(resp.status_int, 404)
+ self.assertEqual(resp.status_int, 404)
def test_anonymous_options_allowed(self):
req = self._make_request('/v1/AUTH_account',
@@ -611,7 +611,7 @@ class TestAuthorize(BaseTestAuthorize):
if exception and not result:
self.fail("error %s was not returned" % (str(exception)))
elif exception:
- self.assertEquals(result.status_int, exception)
+ self.assertEqual(result.status_int, exception)
else:
self.assertTrue(result is None)
return req
@@ -928,7 +928,7 @@ class TestAuthorize(BaseTestAuthorize):
'roles': list(roles)}
data = self.test_auth._keystone_identity(req.environ)
- self.assertEquals(expected, data)
+ self.assertEqual(expected, data)
def test_integral_keystone_identity(self):
user = ('U_ID', 'U_NAME')
@@ -967,7 +967,7 @@ class TestAuthorize(BaseTestAuthorize):
'project_domain': (None, None),
'auth_version': 0}
data = self.test_auth._integral_keystone_identity(req.environ)
- self.assertEquals(expected, data)
+ self.assertEqual(expected, data)
# v2 token info in environ
req.environ['keystone.token_info'] = _fake_token_info(version='2')
@@ -979,7 +979,7 @@ class TestAuthorize(BaseTestAuthorize):
'project_domain': (None, None),
'auth_version': 2}
data = self.test_auth._integral_keystone_identity(req.environ)
- self.assertEquals(expected, data)
+ self.assertEqual(expected, data)
# v3 token info in environ
req.environ['keystone.token_info'] = _fake_token_info(version='3')
@@ -991,7 +991,7 @@ class TestAuthorize(BaseTestAuthorize):
'project_domain': project_domain,
'auth_version': 3}
data = self.test_auth._integral_keystone_identity(req.environ)
- self.assertEquals(expected, data)
+ self.assertEqual(expected, data)
# service token in environ
req.headers.update({'X-Service-Roles': '%s,%s' % service_roles})
@@ -1003,7 +1003,7 @@ class TestAuthorize(BaseTestAuthorize):
'project_domain': project_domain,
'auth_version': 3}
data = self.test_auth._integral_keystone_identity(req.environ)
- self.assertEquals(expected, data)
+ self.assertEqual(expected, data)
def test_get_project_domain_id(self):
sysmeta = {}
diff --git a/test/unit/common/middleware/test_list_endpoints.py b/test/unit/common/middleware/test_list_endpoints.py
index 00dd426b93..cc78e8f479 100644
--- a/test/unit/common/middleware/test_list_endpoints.py
+++ b/test/unit/common/middleware/test_list_endpoints.py
@@ -112,8 +112,8 @@ class TestListEndpoints(unittest.TestCase):
info['storage_policy'] = self.policy_to_test
(version, account, container, unused) = \
split_path(env['PATH_INFO'], 3, 4, True)
- self.assertEquals((version, account, container),
- self.expected_path[:3])
+ self.assertEqual((version, account, container),
+ self.expected_path[:3])
return info
def test_parse_response_version(self):
@@ -194,10 +194,10 @@ class TestListEndpoints(unittest.TestCase):
self.assertEqual(obj, None)
def test_get_object_ring(self):
- self.assertEquals(isinstance(self.list_endpoints.get_object_ring(0),
- ring.Ring), True)
- self.assertEquals(isinstance(self.list_endpoints.get_object_ring(1),
- ring.Ring), True)
+ self.assertEqual(isinstance(self.list_endpoints.get_object_ring(0),
+ ring.Ring), True)
+ self.assertEqual(isinstance(self.list_endpoints.get_object_ring(1),
+ ring.Ring), True)
self.assertRaises(ValueError, self.list_endpoints.get_object_ring, 99)
def test_parse_path_no_version_specified(self):
@@ -238,9 +238,9 @@ class TestListEndpoints(unittest.TestCase):
# ring.get_nodes().
resp = Request.blank('/endpoints/a/c/o1').get_response(
self.list_endpoints)
- self.assertEquals(resp.status_int, 200)
- self.assertEquals(resp.content_type, 'application/json')
- self.assertEquals(json.loads(resp.body), [
+ self.assertEqual(resp.status_int, 200)
+ self.assertEqual(resp.content_type, 'application/json')
+ self.assertEqual(json.loads(resp.body), [
"http://10.1.1.1:6000/sdb1/1/a/c/o1",
"http://10.1.2.2:6000/sdd1/1/a/c/o1"
])
@@ -258,31 +258,31 @@ class TestListEndpoints(unittest.TestCase):
with mock.patch(PATCHGI, self.FakeGetInfo):
resp = Request.blank('/endpoints/a/c/o1').get_response(
self.list_endpoints)
- self.assertEquals(resp.status_int, 200)
- self.assertEquals(resp.content_type, 'application/json')
- self.assertEquals(json.loads(resp.body), expected[pol.idx])
+ self.assertEqual(resp.status_int, 200)
+ self.assertEqual(resp.content_type, 'application/json')
+ self.assertEqual(json.loads(resp.body), expected[pol.idx])
# Here, 'o1/' is the object name.
resp = Request.blank('/endpoints/a/c/o1/').get_response(
self.list_endpoints)
- self.assertEquals(resp.status_int, 200)
- self.assertEquals(json.loads(resp.body), [
+ self.assertEqual(resp.status_int, 200)
+ self.assertEqual(json.loads(resp.body), [
"http://10.1.1.1:6000/sdb1/3/a/c/o1/",
"http://10.1.2.2:6000/sdd1/3/a/c/o1/"
])
resp = Request.blank('/endpoints/a/c2').get_response(
self.list_endpoints)
- self.assertEquals(resp.status_int, 200)
- self.assertEquals(json.loads(resp.body), [
+ self.assertEqual(resp.status_int, 200)
+ self.assertEqual(json.loads(resp.body), [
"http://10.1.1.1:6000/sda1/2/a/c2",
"http://10.1.2.1:6000/sdc1/2/a/c2"
])
resp = Request.blank('/endpoints/a1').get_response(
self.list_endpoints)
- self.assertEquals(resp.status_int, 200)
- self.assertEquals(json.loads(resp.body), [
+ self.assertEqual(resp.status_int, 200)
+ self.assertEqual(json.loads(resp.body), [
"http://10.1.2.1:6000/sdc1/0/a1",
"http://10.1.1.1:6000/sda1/0/a1",
"http://10.1.1.1:6000/sdb1/0/a1"
@@ -290,43 +290,43 @@ class TestListEndpoints(unittest.TestCase):
resp = Request.blank('/endpoints/').get_response(
self.list_endpoints)
- self.assertEquals(resp.status_int, 400)
+ self.assertEqual(resp.status_int, 400)
resp = Request.blank('/endpoints/a/c 2').get_response(
self.list_endpoints)
- self.assertEquals(resp.status_int, 200)
- self.assertEquals(json.loads(resp.body), [
+ self.assertEqual(resp.status_int, 200)
+ self.assertEqual(json.loads(resp.body), [
"http://10.1.1.1:6000/sdb1/3/a/c%202",
"http://10.1.2.2:6000/sdd1/3/a/c%202"
])
resp = Request.blank('/endpoints/a/c%202').get_response(
self.list_endpoints)
- self.assertEquals(resp.status_int, 200)
- self.assertEquals(json.loads(resp.body), [
+ self.assertEqual(resp.status_int, 200)
+ self.assertEqual(json.loads(resp.body), [
"http://10.1.1.1:6000/sdb1/3/a/c%202",
"http://10.1.2.2:6000/sdd1/3/a/c%202"
])
resp = Request.blank('/endpoints/ac%20count/con%20tainer/ob%20ject') \
.get_response(self.list_endpoints)
- self.assertEquals(resp.status_int, 200)
- self.assertEquals(json.loads(resp.body), [
+ self.assertEqual(resp.status_int, 200)
+ self.assertEqual(json.loads(resp.body), [
"http://10.1.1.1:6000/sdb1/3/ac%20count/con%20tainer/ob%20ject",
"http://10.1.2.2:6000/sdd1/3/ac%20count/con%20tainer/ob%20ject"
])
resp = Request.blank('/endpoints/a/c/o1', {'REQUEST_METHOD': 'POST'}) \
.get_response(self.list_endpoints)
- self.assertEquals(resp.status_int, 405)
- self.assertEquals(resp.status, '405 Method Not Allowed')
- self.assertEquals(resp.headers['allow'], 'GET')
+ self.assertEqual(resp.status_int, 405)
+ self.assertEqual(resp.status, '405 Method Not Allowed')
+ self.assertEqual(resp.headers['allow'], 'GET')
resp = Request.blank('/not-endpoints').get_response(
self.list_endpoints)
- self.assertEquals(resp.status_int, 200)
- self.assertEquals(resp.status, '200 OK')
- self.assertEquals(resp.body, 'FakeApp')
+ self.assertEqual(resp.status_int, 200)
+ self.assertEqual(resp.status, '200 OK')
+ self.assertEqual(resp.body, 'FakeApp')
# test policies with custom endpoint name
for pol in POLICIES:
@@ -339,9 +339,9 @@ class TestListEndpoints(unittest.TestCase):
with mock.patch(PATCHGI, self.FakeGetInfo):
resp = Request.blank('/some/another/path/a/c/o1') \
.get_response(custom_path_le)
- self.assertEquals(resp.status_int, 200)
- self.assertEquals(resp.content_type, 'application/json')
- self.assertEquals(json.loads(resp.body), expected[pol.idx])
+ self.assertEqual(resp.status_int, 200)
+ self.assertEqual(resp.content_type, 'application/json')
+ self.assertEqual(json.loads(resp.body), expected[pol.idx])
# test custom path without trailing slash
custom_path_le = list_endpoints.filter_factory({
@@ -352,9 +352,9 @@ class TestListEndpoints(unittest.TestCase):
with mock.patch(PATCHGI, self.FakeGetInfo):
resp = Request.blank('/some/another/path/a/c/o1') \
.get_response(custom_path_le)
- self.assertEquals(resp.status_int, 200)
- self.assertEquals(resp.content_type, 'application/json')
- self.assertEquals(json.loads(resp.body), expected[pol.idx])
+ self.assertEqual(resp.status_int, 200)
+ self.assertEqual(resp.content_type, 'application/json')
+ self.assertEqual(json.loads(resp.body), expected[pol.idx])
def test_v1_response(self):
req = Request.blank('/endpoints/v1/a/c/o1')
diff --git a/test/unit/common/middleware/test_memcache.py b/test/unit/common/middleware/test_memcache.py
index 44c4fc3987..286b707e2a 100644
--- a/test/unit/common/middleware/test_memcache.py
+++ b/test/unit/common/middleware/test_memcache.py
@@ -126,13 +126,13 @@ class TestCacheMiddleware(unittest.TestCase):
try:
memcache.MemcacheMiddleware(FakeApp(), d)
except Exception as err:
- self.assertEquals(
+ self.assertEqual(
str(err),
"read called with '/etc/swift/memcache.conf'")
count += 1
finally:
memcache.ConfigParser = orig_parser
- self.assertEquals(count, 7)
+ self.assertEqual(count, 7)
def test_conf_set_no_read(self):
orig_parser = memcache.ConfigParser
@@ -147,7 +147,7 @@ class TestCacheMiddleware(unittest.TestCase):
exc = err
finally:
memcache.ConfigParser = orig_parser
- self.assertEquals(exc, None)
+ self.assertEqual(exc, None)
def test_conf_default(self):
orig_parser = memcache.ConfigParser
@@ -156,10 +156,10 @@ class TestCacheMiddleware(unittest.TestCase):
app = memcache.MemcacheMiddleware(FakeApp(), {})
finally:
memcache.ConfigParser = orig_parser
- self.assertEquals(app.memcache_servers, '127.0.0.1:11211')
- self.assertEquals(app.memcache._allow_pickle, False)
- self.assertEquals(app.memcache._allow_unpickle, False)
- self.assertEquals(
+ self.assertEqual(app.memcache_servers, '127.0.0.1:11211')
+ self.assertEqual(app.memcache._allow_pickle, False)
+ self.assertEqual(app.memcache._allow_unpickle, False)
+ self.assertEqual(
app.memcache._client_cache['127.0.0.1:11211'].max_size, 2)
def test_conf_inline(self):
@@ -173,10 +173,10 @@ class TestCacheMiddleware(unittest.TestCase):
'memcache_max_connections': '5'})
finally:
memcache.ConfigParser = orig_parser
- self.assertEquals(app.memcache_servers, '6.7.8.9:10')
- self.assertEquals(app.memcache._allow_pickle, True)
- self.assertEquals(app.memcache._allow_unpickle, True)
- self.assertEquals(
+ self.assertEqual(app.memcache_servers, '6.7.8.9:10')
+ self.assertEqual(app.memcache._allow_pickle, True)
+ self.assertEqual(app.memcache._allow_unpickle, True)
+ self.assertEqual(
app.memcache._client_cache['6.7.8.9:10'].max_size, 5)
def test_conf_extra_no_section(self):
@@ -186,10 +186,10 @@ class TestCacheMiddleware(unittest.TestCase):
app = memcache.MemcacheMiddleware(FakeApp(), {})
finally:
memcache.ConfigParser = orig_parser
- self.assertEquals(app.memcache_servers, '127.0.0.1:11211')
- self.assertEquals(app.memcache._allow_pickle, False)
- self.assertEquals(app.memcache._allow_unpickle, False)
- self.assertEquals(
+ self.assertEqual(app.memcache_servers, '127.0.0.1:11211')
+ self.assertEqual(app.memcache._allow_pickle, False)
+ self.assertEqual(app.memcache._allow_unpickle, False)
+ self.assertEqual(
app.memcache._client_cache['127.0.0.1:11211'].max_size, 2)
def test_conf_extra_no_option(self):
@@ -201,10 +201,10 @@ class TestCacheMiddleware(unittest.TestCase):
app = memcache.MemcacheMiddleware(FakeApp(), {})
finally:
memcache.ConfigParser = orig_parser
- self.assertEquals(app.memcache_servers, '127.0.0.1:11211')
- self.assertEquals(app.memcache._allow_pickle, False)
- self.assertEquals(app.memcache._allow_unpickle, False)
- self.assertEquals(
+ self.assertEqual(app.memcache_servers, '127.0.0.1:11211')
+ self.assertEqual(app.memcache._allow_pickle, False)
+ self.assertEqual(app.memcache._allow_unpickle, False)
+ self.assertEqual(
app.memcache._client_cache['127.0.0.1:11211'].max_size, 2)
def test_conf_inline_other_max_conn(self):
@@ -218,10 +218,10 @@ class TestCacheMiddleware(unittest.TestCase):
'max_connections': '5'})
finally:
memcache.ConfigParser = orig_parser
- self.assertEquals(app.memcache_servers, '6.7.8.9:10')
- self.assertEquals(app.memcache._allow_pickle, True)
- self.assertEquals(app.memcache._allow_unpickle, True)
- self.assertEquals(
+ self.assertEqual(app.memcache_servers, '6.7.8.9:10')
+ self.assertEqual(app.memcache._allow_pickle, True)
+ self.assertEqual(app.memcache._allow_unpickle, True)
+ self.assertEqual(
app.memcache._client_cache['6.7.8.9:10'].max_size, 5)
def test_conf_inline_bad_max_conn(self):
@@ -235,10 +235,10 @@ class TestCacheMiddleware(unittest.TestCase):
'max_connections': 'bad42'})
finally:
memcache.ConfigParser = orig_parser
- self.assertEquals(app.memcache_servers, '6.7.8.9:10')
- self.assertEquals(app.memcache._allow_pickle, True)
- self.assertEquals(app.memcache._allow_unpickle, True)
- self.assertEquals(
+ self.assertEqual(app.memcache_servers, '6.7.8.9:10')
+ self.assertEqual(app.memcache._allow_pickle, True)
+ self.assertEqual(app.memcache._allow_unpickle, True)
+ self.assertEqual(
app.memcache._client_cache['6.7.8.9:10'].max_size, 4)
def test_conf_from_extra_conf(self):
@@ -248,10 +248,10 @@ class TestCacheMiddleware(unittest.TestCase):
app = memcache.MemcacheMiddleware(FakeApp(), {})
finally:
memcache.ConfigParser = orig_parser
- self.assertEquals(app.memcache_servers, '1.2.3.4:5')
- self.assertEquals(app.memcache._allow_pickle, False)
- self.assertEquals(app.memcache._allow_unpickle, True)
- self.assertEquals(
+ self.assertEqual(app.memcache_servers, '1.2.3.4:5')
+ self.assertEqual(app.memcache._allow_pickle, False)
+ self.assertEqual(app.memcache._allow_unpickle, True)
+ self.assertEqual(
app.memcache._client_cache['1.2.3.4:5'].max_size, 4)
def test_conf_from_extra_conf_bad_max_conn(self):
@@ -262,10 +262,10 @@ class TestCacheMiddleware(unittest.TestCase):
app = memcache.MemcacheMiddleware(FakeApp(), {})
finally:
memcache.ConfigParser = orig_parser
- self.assertEquals(app.memcache_servers, '1.2.3.4:5')
- self.assertEquals(app.memcache._allow_pickle, False)
- self.assertEquals(app.memcache._allow_unpickle, True)
- self.assertEquals(
+ self.assertEqual(app.memcache_servers, '1.2.3.4:5')
+ self.assertEqual(app.memcache._allow_pickle, False)
+ self.assertEqual(app.memcache._allow_unpickle, True)
+ self.assertEqual(
app.memcache._client_cache['1.2.3.4:5'].max_size, 2)
def test_conf_from_inline_and_maxc_from_extra_conf(self):
@@ -278,10 +278,10 @@ class TestCacheMiddleware(unittest.TestCase):
'memcache_serialization_support': '0'})
finally:
memcache.ConfigParser = orig_parser
- self.assertEquals(app.memcache_servers, '6.7.8.9:10')
- self.assertEquals(app.memcache._allow_pickle, True)
- self.assertEquals(app.memcache._allow_unpickle, True)
- self.assertEquals(
+ self.assertEqual(app.memcache_servers, '6.7.8.9:10')
+ self.assertEqual(app.memcache._allow_pickle, True)
+ self.assertEqual(app.memcache._allow_unpickle, True)
+ self.assertEqual(
app.memcache._client_cache['6.7.8.9:10'].max_size, 4)
def test_conf_from_inline_and_sers_from_extra_conf(self):
@@ -294,10 +294,10 @@ class TestCacheMiddleware(unittest.TestCase):
'memcache_max_connections': '42'})
finally:
memcache.ConfigParser = orig_parser
- self.assertEquals(app.memcache_servers, '6.7.8.9:10')
- self.assertEquals(app.memcache._allow_pickle, False)
- self.assertEquals(app.memcache._allow_unpickle, True)
- self.assertEquals(
+ self.assertEqual(app.memcache_servers, '6.7.8.9:10')
+ self.assertEqual(app.memcache._allow_pickle, False)
+ self.assertEqual(app.memcache._allow_unpickle, True)
+ self.assertEqual(
app.memcache._client_cache['6.7.8.9:10'].max_size, 42)
def test_filter_factory(self):
@@ -305,11 +305,11 @@ class TestCacheMiddleware(unittest.TestCase):
memcache_servers='10.10.10.10:10',
memcache_serialization_support='1')
thefilter = factory('myapp')
- self.assertEquals(thefilter.app, 'myapp')
- self.assertEquals(thefilter.memcache_servers, '10.10.10.10:10')
- self.assertEquals(thefilter.memcache._allow_pickle, False)
- self.assertEquals(thefilter.memcache._allow_unpickle, True)
- self.assertEquals(
+ self.assertEqual(thefilter.app, 'myapp')
+ self.assertEqual(thefilter.memcache_servers, '10.10.10.10:10')
+ self.assertEqual(thefilter.memcache._allow_pickle, False)
+ self.assertEqual(thefilter.memcache._allow_unpickle, True)
+ self.assertEqual(
thefilter.memcache._client_cache['10.10.10.10:10'].max_size, 3)
@patch_policies
diff --git a/test/unit/common/middleware/test_name_check.py b/test/unit/common/middleware/test_name_check.py
index eaf28fa864..89be2daf56 100644
--- a/test/unit/common/middleware/test_name_check.py
+++ b/test/unit/common/middleware/test_name_check.py
@@ -48,7 +48,7 @@ class TestNameCheckMiddleware(unittest.TestCase):
path = '/V1.0/' + 'c' * (MAX_LENGTH - 6)
resp = Request.blank(path, environ={'REQUEST_METHOD': 'PUT'}
).get_response(self.test_check)
- self.assertEquals(resp.body, 'OK')
+ self.assertEqual(resp.body, 'OK')
def test_invalid_character(self):
for c in self.conf['forbidden_chars']:
@@ -56,11 +56,11 @@ class TestNameCheckMiddleware(unittest.TestCase):
resp = Request.blank(
path, environ={'REQUEST_METHOD': 'PUT'}).get_response(
self.test_check)
- self.assertEquals(
+ self.assertEqual(
resp.body,
("Object/Container/Account name contains forbidden chars "
"from %s" % self.conf['forbidden_chars']))
- self.assertEquals(resp.status_int, 400)
+ self.assertEqual(resp.status_int, 400)
def test_maximum_length_from_config(self):
# test invalid length
@@ -70,29 +70,29 @@ class TestNameCheckMiddleware(unittest.TestCase):
path = '/V1.0/a/c' + 'o' * (500 - 8)
resp = Request.blank(path, environ={'REQUEST_METHOD': 'PUT'}
).get_response(self.test_check)
- self.assertEquals(
+ self.assertEqual(
resp.body,
("Object/Container/Account name longer than the allowed "
"maximum 500"))
- self.assertEquals(resp.status_int, 400)
+ self.assertEqual(resp.status_int, 400)
# test valid length
path = '/V1.0/a/c' + 'o' * (MAX_LENGTH - 10)
resp = Request.blank(path, environ={'REQUEST_METHOD': 'PUT'}
).get_response(self.test_check)
- self.assertEquals(resp.status_int, 200)
- self.assertEquals(resp.body, 'OK')
+ self.assertEqual(resp.status_int, 200)
+ self.assertEqual(resp.body, 'OK')
self.test_check = orig_test_check
def test_invalid_length(self):
path = '/V1.0/' + 'c' * (MAX_LENGTH - 5)
resp = Request.blank(path, environ={'REQUEST_METHOD': 'PUT'}
).get_response(self.test_check)
- self.assertEquals(
+ self.assertEqual(
resp.body,
("Object/Container/Account name longer than the allowed maximum %s"
% self.conf['maximum_length']))
- self.assertEquals(resp.status_int, 400)
+ self.assertEqual(resp.status_int, 400)
def test_invalid_regexp(self):
for s in ['/.', '/..', '/./foo', '/../foo']:
@@ -100,12 +100,12 @@ class TestNameCheckMiddleware(unittest.TestCase):
resp = Request.blank(
path, environ={'REQUEST_METHOD': 'PUT'}).get_response(
self.test_check)
- self.assertEquals(
+ self.assertEqual(
resp.body,
("Object/Container/Account name contains a forbidden "
"substring from regular expression %s"
% self.conf['forbidden_regexp']))
- self.assertEquals(resp.status_int, 400)
+ self.assertEqual(resp.status_int, 400)
def test_valid_regexp(self):
for s in ['/...', '/.\.', '/foo']:
@@ -113,7 +113,7 @@ class TestNameCheckMiddleware(unittest.TestCase):
resp = Request.blank(
path, environ={'REQUEST_METHOD': 'PUT'}).get_response(
self.test_check)
- self.assertEquals(resp.body, 'OK')
+ self.assertEqual(resp.body, 'OK')
if __name__ == '__main__':
diff --git a/test/unit/common/middleware/test_proxy_logging.py b/test/unit/common/middleware/test_proxy_logging.py
index d7d22aaae4..19866cb793 100644
--- a/test/unit/common/middleware/test_proxy_logging.py
+++ b/test/unit/common/middleware/test_proxy_logging.py
@@ -114,17 +114,17 @@ class TestProxyLogging(unittest.TestCase):
def _log_parts(self, app, should_be_empty=False):
info_calls = app.access_logger.log_dict['info']
if should_be_empty:
- self.assertEquals([], info_calls)
+ self.assertEqual([], info_calls)
else:
- self.assertEquals(1, len(info_calls))
+ self.assertEqual(1, len(info_calls))
return info_calls[0][0][0].split(' ')
def assertTiming(self, exp_metric, app, exp_timing=None):
timing_calls = app.access_logger.log_dict['timing']
found = False
for timing_call in timing_calls:
- self.assertEquals({}, timing_call[1])
- self.assertEquals(2, len(timing_call[0]))
+ self.assertEqual({}, timing_call[1])
+ self.assertEqual(2, len(timing_call[0]))
if timing_call[0][0] == exp_metric:
found = True
if exp_timing is not None:
@@ -138,8 +138,8 @@ class TestProxyLogging(unittest.TestCase):
timing_calls = app.access_logger.log_dict['timing_since']
found = False
for timing_call in timing_calls:
- self.assertEquals({}, timing_call[1])
- self.assertEquals(2, len(timing_call[0]))
+ self.assertEqual({}, timing_call[1])
+ self.assertEqual(2, len(timing_call[0]))
if timing_call[0][0] == exp_metric:
found = True
if exp_start is not None:
@@ -395,12 +395,12 @@ class TestProxyLogging(unittest.TestCase):
resp = app(req.environ, start_response)
resp_body = ''.join(resp)
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[3], 'GET')
- self.assertEquals(log_parts[4], '/')
- self.assertEquals(log_parts[5], 'HTTP/1.0')
- self.assertEquals(log_parts[6], '200')
- self.assertEquals(resp_body, 'FAKE APP')
- self.assertEquals(log_parts[11], str(len(resp_body)))
+ self.assertEqual(log_parts[3], 'GET')
+ self.assertEqual(log_parts[4], '/')
+ self.assertEqual(log_parts[5], 'HTTP/1.0')
+ self.assertEqual(log_parts[6], '200')
+ self.assertEqual(resp_body, 'FAKE APP')
+ self.assertEqual(log_parts[11], str(len(resp_body)))
def test_basic_req_second_time(self):
app = proxy_logging.ProxyLoggingMiddleware(FakeApp(), {})
@@ -411,7 +411,7 @@ class TestProxyLogging(unittest.TestCase):
resp = app(req.environ, start_response)
resp_body = ''.join(resp)
self._log_parts(app, should_be_empty=True)
- self.assertEquals(resp_body, 'FAKE APP')
+ self.assertEqual(resp_body, 'FAKE APP')
def test_multi_segment_resp(self):
app = proxy_logging.ProxyLoggingMiddleware(FakeApp(
@@ -422,12 +422,12 @@ class TestProxyLogging(unittest.TestCase):
resp = app(req.environ, start_response)
resp_body = ''.join(resp)
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[3], 'GET')
- self.assertEquals(log_parts[4], '/')
- self.assertEquals(log_parts[5], 'HTTP/1.0')
- self.assertEquals(log_parts[6], '200')
- self.assertEquals(resp_body, 'somechunksof data')
- self.assertEquals(log_parts[11], str(len(resp_body)))
+ self.assertEqual(log_parts[3], 'GET')
+ self.assertEqual(log_parts[4], '/')
+ self.assertEqual(log_parts[5], 'HTTP/1.0')
+ self.assertEqual(log_parts[6], '200')
+ self.assertEqual(resp_body, 'somechunksof data')
+ self.assertEqual(log_parts[11], str(len(resp_body)))
self.assertUpdateStats([('SOS.GET.200.xfer', len(resp_body))], app)
def test_log_headers(self):
@@ -476,8 +476,8 @@ class TestProxyLogging(unittest.TestCase):
# exhaust generator
[x for x in resp]
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[11], str(len('FAKE APP')))
- self.assertEquals(log_parts[10], str(len('some stuff')))
+ self.assertEqual(log_parts[11], str(len('FAKE APP')))
+ self.assertEqual(log_parts[10], str(len('some stuff')))
self.assertUpdateStats([('object.PUT.200.xfer',
len('some stuff') + len('FAKE APP')),
('object.policy.0.PUT.200.xfer',
@@ -496,8 +496,8 @@ class TestProxyLogging(unittest.TestCase):
# exhaust generator
[x for x in resp]
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[11], str(len('FAKE APP')))
- self.assertEquals(log_parts[10], str(len('some stuff')))
+ self.assertEqual(log_parts[11], str(len('FAKE APP')))
+ self.assertEqual(log_parts[10], str(len('some stuff')))
self.assertUpdateStats([('object.PUT.200.xfer',
len('some stuff') + len('FAKE APP'))],
app)
@@ -514,8 +514,8 @@ class TestProxyLogging(unittest.TestCase):
# exhaust generator
[x for x in resp]
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[11], str(len('FAKE APP')))
- self.assertEquals(log_parts[10], str(len('some stuff')))
+ self.assertEqual(log_parts[11], str(len('FAKE APP')))
+ self.assertEqual(log_parts[10], str(len('some stuff')))
self.assertUpdateStats([('object.PUT.200.xfer',
len('some stuff') + len('FAKE APP'))],
app)
@@ -532,8 +532,8 @@ class TestProxyLogging(unittest.TestCase):
# exhaust generator
[x for x in resp]
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[11], str(len('FAKE APP')))
- self.assertEquals(log_parts[10], str(len('some stuff\n')))
+ self.assertEqual(log_parts[11], str(len('FAKE APP')))
+ self.assertEqual(log_parts[10], str(len('some stuff\n')))
self.assertUpdateStats([('container.POST.200.xfer',
len('some stuff\n') + len('FAKE APP'))],
app)
@@ -547,7 +547,7 @@ class TestProxyLogging(unittest.TestCase):
# exhaust generator
[x for x in resp]
log_parts = self._log_parts(app)
- self.assertEquals(unquote(log_parts[4]), '/?x=3')
+ self.assertEqual(unquote(log_parts[4]), '/?x=3')
def test_client_logging(self):
app = proxy_logging.ProxyLoggingMiddleware(FakeApp(), {})
@@ -558,8 +558,8 @@ class TestProxyLogging(unittest.TestCase):
# exhaust generator
[x for x in resp]
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[0], '1.2.3.4') # client ip
- self.assertEquals(log_parts[1], '1.2.3.4') # remote addr
+ self.assertEqual(log_parts[0], '1.2.3.4') # client ip
+ self.assertEqual(log_parts[1], '1.2.3.4') # remote addr
def test_iterator_closing(self):
@@ -593,8 +593,8 @@ class TestProxyLogging(unittest.TestCase):
# exhaust generator
[x for x in resp]
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[0], '4.5.6.7') # client ip
- self.assertEquals(log_parts[1], '1.2.3.4') # remote addr
+ self.assertEqual(log_parts[0], '4.5.6.7') # client ip
+ self.assertEqual(log_parts[1], '1.2.3.4') # remote addr
app = proxy_logging.ProxyLoggingMiddleware(FakeApp(), {})
app.access_logger = FakeLogger()
@@ -606,8 +606,8 @@ class TestProxyLogging(unittest.TestCase):
# exhaust generator
[x for x in resp]
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[0], '4.5.6.7') # client ip
- self.assertEquals(log_parts[1], '1.2.3.4') # remote addr
+ self.assertEqual(log_parts[0], '4.5.6.7') # client ip
+ self.assertEqual(log_parts[1], '1.2.3.4') # remote addr
def test_facility(self):
app = proxy_logging.ProxyLoggingMiddleware(
@@ -615,7 +615,7 @@ class TestProxyLogging(unittest.TestCase):
{'log_headers': 'yes',
'access_log_facility': 'LOG_LOCAL7'})
handler = get_logger.handler4logger[app.access_logger.logger]
- self.assertEquals(SysLogHandler.LOG_LOCAL7, handler.facility)
+ self.assertEqual(SysLogHandler.LOG_LOCAL7, handler.facility)
def test_filter(self):
factory = proxy_logging.filter_factory({})
@@ -632,8 +632,8 @@ class TestProxyLogging(unittest.TestCase):
next(resp)
resp.close() # raise a GeneratorExit in middleware app_iter loop
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[6], '499')
- self.assertEquals(log_parts[11], '4') # write length
+ self.assertEqual(log_parts[6], '499')
+ self.assertEqual(log_parts[11], '4') # write length
def test_disconnect_on_readline(self):
app = proxy_logging.ProxyLoggingMiddleware(FakeAppReadline(), {})
@@ -647,8 +647,8 @@ class TestProxyLogging(unittest.TestCase):
except IOError:
pass
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[6], '499')
- self.assertEquals(log_parts[10], '-') # read length
+ self.assertEqual(log_parts[6], '499')
+ self.assertEqual(log_parts[10], '-') # read length
def test_disconnect_on_read(self):
app = proxy_logging.ProxyLoggingMiddleware(
@@ -663,8 +663,8 @@ class TestProxyLogging(unittest.TestCase):
except IOError:
pass
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[6], '499')
- self.assertEquals(log_parts[10], '-') # read length
+ self.assertEqual(log_parts[6], '499')
+ self.assertEqual(log_parts[10], '-') # read length
def test_app_exception(self):
app = proxy_logging.ProxyLoggingMiddleware(
@@ -676,8 +676,8 @@ class TestProxyLogging(unittest.TestCase):
except Exception:
pass
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[6], '500')
- self.assertEquals(log_parts[10], '-') # read length
+ self.assertEqual(log_parts[6], '500')
+ self.assertEqual(log_parts[10], '-') # read length
def test_no_content_length_no_transfer_encoding_with_list_body(self):
app = proxy_logging.ProxyLoggingMiddleware(
@@ -690,12 +690,12 @@ class TestProxyLogging(unittest.TestCase):
resp = app(req.environ, start_response)
resp_body = ''.join(resp)
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[3], 'GET')
- self.assertEquals(log_parts[4], '/')
- self.assertEquals(log_parts[5], 'HTTP/1.0')
- self.assertEquals(log_parts[6], '200')
- self.assertEquals(resp_body, 'line1\nline2\n')
- self.assertEquals(log_parts[11], str(len(resp_body)))
+ self.assertEqual(log_parts[3], 'GET')
+ self.assertEqual(log_parts[4], '/')
+ self.assertEqual(log_parts[5], 'HTTP/1.0')
+ self.assertEqual(log_parts[6], '200')
+ self.assertEqual(resp_body, 'line1\nline2\n')
+ self.assertEqual(log_parts[11], str(len(resp_body)))
def test_no_content_length_no_transfer_encoding_with_empty_strings(self):
app = proxy_logging.ProxyLoggingMiddleware(
@@ -708,12 +708,12 @@ class TestProxyLogging(unittest.TestCase):
resp = app(req.environ, start_response)
resp_body = ''.join(resp)
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[3], 'GET')
- self.assertEquals(log_parts[4], '/')
- self.assertEquals(log_parts[5], 'HTTP/1.0')
- self.assertEquals(log_parts[6], '200')
- self.assertEquals(resp_body, '')
- self.assertEquals(log_parts[11], '-')
+ self.assertEqual(log_parts[3], 'GET')
+ self.assertEqual(log_parts[4], '/')
+ self.assertEqual(log_parts[5], 'HTTP/1.0')
+ self.assertEqual(log_parts[6], '200')
+ self.assertEqual(resp_body, '')
+ self.assertEqual(log_parts[11], '-')
def test_no_content_length_no_transfer_encoding_with_generator(self):
@@ -733,28 +733,28 @@ class TestProxyLogging(unittest.TestCase):
resp = app(req.environ, start_response)
resp_body = ''.join(resp)
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[3], 'GET')
- self.assertEquals(log_parts[4], '/')
- self.assertEquals(log_parts[5], 'HTTP/1.0')
- self.assertEquals(log_parts[6], '200')
- self.assertEquals(resp_body, 'abc')
- self.assertEquals(log_parts[11], '3')
+ self.assertEqual(log_parts[3], 'GET')
+ self.assertEqual(log_parts[4], '/')
+ self.assertEqual(log_parts[5], 'HTTP/1.0')
+ self.assertEqual(log_parts[6], '200')
+ self.assertEqual(resp_body, 'abc')
+ self.assertEqual(log_parts[11], '3')
def test_req_path_info_popping(self):
app = proxy_logging.ProxyLoggingMiddleware(FakeApp(), {})
app.access_logger = FakeLogger()
req = Request.blank('/v1/something', environ={'REQUEST_METHOD': 'GET'})
req.path_info_pop()
- self.assertEquals(req.environ['PATH_INFO'], '/something')
+ self.assertEqual(req.environ['PATH_INFO'], '/something')
resp = app(req.environ, start_response)
resp_body = ''.join(resp)
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[3], 'GET')
- self.assertEquals(log_parts[4], '/v1/something')
- self.assertEquals(log_parts[5], 'HTTP/1.0')
- self.assertEquals(log_parts[6], '200')
- self.assertEquals(resp_body, 'FAKE APP')
- self.assertEquals(log_parts[11], str(len(resp_body)))
+ self.assertEqual(log_parts[3], 'GET')
+ self.assertEqual(log_parts[4], '/v1/something')
+ self.assertEqual(log_parts[5], 'HTTP/1.0')
+ self.assertEqual(log_parts[6], '200')
+ self.assertEqual(resp_body, 'FAKE APP')
+ self.assertEqual(log_parts[11], str(len(resp_body)))
def test_ipv6(self):
ipv6addr = '2001:db8:85a3:8d3:1319:8a2e:370:7348'
@@ -765,14 +765,14 @@ class TestProxyLogging(unittest.TestCase):
resp = app(req.environ, start_response)
resp_body = ''.join(resp)
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[0], ipv6addr)
- self.assertEquals(log_parts[1], ipv6addr)
- self.assertEquals(log_parts[3], 'GET')
- self.assertEquals(log_parts[4], '/')
- self.assertEquals(log_parts[5], 'HTTP/1.0')
- self.assertEquals(log_parts[6], '200')
- self.assertEquals(resp_body, 'FAKE APP')
- self.assertEquals(log_parts[11], str(len(resp_body)))
+ self.assertEqual(log_parts[0], ipv6addr)
+ self.assertEqual(log_parts[1], ipv6addr)
+ self.assertEqual(log_parts[3], 'GET')
+ self.assertEqual(log_parts[4], '/')
+ self.assertEqual(log_parts[5], 'HTTP/1.0')
+ self.assertEqual(log_parts[6], '200')
+ self.assertEqual(resp_body, 'FAKE APP')
+ self.assertEqual(log_parts[11], str(len(resp_body)))
def test_log_info_none(self):
app = proxy_logging.ProxyLoggingMiddleware(FakeApp(), {})
@@ -780,7 +780,7 @@ class TestProxyLogging(unittest.TestCase):
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'})
list(app(req.environ, start_response))
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[17], '-')
+ self.assertEqual(log_parts[17], '-')
app = proxy_logging.ProxyLoggingMiddleware(FakeApp(), {})
app.access_logger = FakeLogger()
@@ -788,7 +788,7 @@ class TestProxyLogging(unittest.TestCase):
req.environ['swift.log_info'] = []
list(app(req.environ, start_response))
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[17], '-')
+ self.assertEqual(log_parts[17], '-')
def test_log_info_single(self):
app = proxy_logging.ProxyLoggingMiddleware(FakeApp(), {})
@@ -797,7 +797,7 @@ class TestProxyLogging(unittest.TestCase):
req.environ['swift.log_info'] = ['one']
list(app(req.environ, start_response))
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[17], 'one')
+ self.assertEqual(log_parts[17], 'one')
def test_log_info_multiple(self):
app = proxy_logging.ProxyLoggingMiddleware(FakeApp(), {})
@@ -806,7 +806,7 @@ class TestProxyLogging(unittest.TestCase):
req.environ['swift.log_info'] = ['one', 'and two']
list(app(req.environ, start_response))
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[17], 'one%2Cand%20two')
+ self.assertEqual(log_parts[17], 'one%2Cand%20two')
def test_log_auth_token(self):
auth_token = 'b05bf940-0464-4c0e-8c70-87717d2d73e8'
@@ -819,7 +819,7 @@ class TestProxyLogging(unittest.TestCase):
resp = app(req.environ, start_response)
resp_body = ''.join(resp)
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[9], '-')
+ self.assertEqual(log_parts[9], '-')
# Has x-auth-token header
app = proxy_logging.ProxyLoggingMiddleware(FakeApp(), {})
app.access_logger = FakeLogger()
@@ -828,7 +828,7 @@ class TestProxyLogging(unittest.TestCase):
resp = app(req.environ, start_response)
resp_body = ''.join(resp)
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[9], 'b05bf940-0464-4c...')
+ self.assertEqual(log_parts[9], 'b05bf940-0464-4c...')
# Truncate to first 8 characters
app = proxy_logging.ProxyLoggingMiddleware(FakeApp(), {
@@ -838,7 +838,7 @@ class TestProxyLogging(unittest.TestCase):
resp = app(req.environ, start_response)
resp_body = ''.join(resp)
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[9], '-')
+ self.assertEqual(log_parts[9], '-')
app = proxy_logging.ProxyLoggingMiddleware(FakeApp(), {
'reveal_sensitive_prefix': '8'})
app.access_logger = FakeLogger()
@@ -847,7 +847,7 @@ class TestProxyLogging(unittest.TestCase):
resp = app(req.environ, start_response)
resp_body = ''.join(resp)
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[9], 'b05bf940...')
+ self.assertEqual(log_parts[9], 'b05bf940...')
# Token length and reveal_sensitive_prefix are same (no truncate)
app = proxy_logging.ProxyLoggingMiddleware(FakeApp(), {
@@ -858,7 +858,7 @@ class TestProxyLogging(unittest.TestCase):
resp = app(req.environ, start_response)
resp_body = ''.join(resp)
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[9], auth_token)
+ self.assertEqual(log_parts[9], auth_token)
# No effective limit on auth token
app = proxy_logging.ProxyLoggingMiddleware(FakeApp(), {
@@ -869,7 +869,7 @@ class TestProxyLogging(unittest.TestCase):
resp = app(req.environ, start_response)
resp_body = ''.join(resp)
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[9], auth_token)
+ self.assertEqual(log_parts[9], auth_token)
# Don't log x-auth-token
app = proxy_logging.ProxyLoggingMiddleware(FakeApp(), {
@@ -879,7 +879,7 @@ class TestProxyLogging(unittest.TestCase):
resp = app(req.environ, start_response)
resp_body = ''.join(resp)
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[9], '-')
+ self.assertEqual(log_parts[9], '-')
app = proxy_logging.ProxyLoggingMiddleware(FakeApp(), {
'reveal_sensitive_prefix': '0'})
app.access_logger = FakeLogger()
@@ -888,7 +888,7 @@ class TestProxyLogging(unittest.TestCase):
resp = app(req.environ, start_response)
resp_body = ''.join(resp)
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[9], '...')
+ self.assertEqual(log_parts[9], '...')
# Avoids pyflakes error, "local variable 'resp_body' is assigned to
# but never used
@@ -904,29 +904,29 @@ class TestProxyLogging(unittest.TestCase):
resp = app(req.environ, start_response)
resp_body = ''.join(resp)
log_parts = self._log_parts(app)
- self.assertEquals(len(log_parts), 21)
- self.assertEquals(log_parts[0], '-')
- self.assertEquals(log_parts[1], '-')
- self.assertEquals(log_parts[2], '26/Apr/1970/17/46/41')
- self.assertEquals(log_parts[3], 'GET')
- self.assertEquals(log_parts[4], '/')
- self.assertEquals(log_parts[5], 'HTTP/1.0')
- self.assertEquals(log_parts[6], '200')
- self.assertEquals(log_parts[7], '-')
- self.assertEquals(log_parts[8], '-')
- self.assertEquals(log_parts[9], '-')
- self.assertEquals(log_parts[10], '-')
- self.assertEquals(resp_body, 'FAKE APP')
- self.assertEquals(log_parts[11], str(len(resp_body)))
- self.assertEquals(log_parts[12], '-')
- self.assertEquals(log_parts[13], '-')
- self.assertEquals(log_parts[14], '-')
- self.assertEquals(log_parts[15], '1.0000')
- self.assertEquals(log_parts[16], '-')
- self.assertEquals(log_parts[17], '-')
- self.assertEquals(log_parts[18], '10000000.000000000')
- self.assertEquals(log_parts[19], '10000001.000000000')
- self.assertEquals(log_parts[20], '-')
+ self.assertEqual(len(log_parts), 21)
+ self.assertEqual(log_parts[0], '-')
+ self.assertEqual(log_parts[1], '-')
+ self.assertEqual(log_parts[2], '26/Apr/1970/17/46/41')
+ self.assertEqual(log_parts[3], 'GET')
+ self.assertEqual(log_parts[4], '/')
+ self.assertEqual(log_parts[5], 'HTTP/1.0')
+ self.assertEqual(log_parts[6], '200')
+ self.assertEqual(log_parts[7], '-')
+ self.assertEqual(log_parts[8], '-')
+ self.assertEqual(log_parts[9], '-')
+ self.assertEqual(log_parts[10], '-')
+ self.assertEqual(resp_body, 'FAKE APP')
+ self.assertEqual(log_parts[11], str(len(resp_body)))
+ self.assertEqual(log_parts[12], '-')
+ self.assertEqual(log_parts[13], '-')
+ self.assertEqual(log_parts[14], '-')
+ self.assertEqual(log_parts[15], '1.0000')
+ self.assertEqual(log_parts[16], '-')
+ self.assertEqual(log_parts[17], '-')
+ self.assertEqual(log_parts[18], '10000000.000000000')
+ self.assertEqual(log_parts[19], '10000001.000000000')
+ self.assertEqual(log_parts[20], '-')
def test_dual_logging_middlewares(self):
# Since no internal request is being made, outer most proxy logging
@@ -943,12 +943,12 @@ class TestProxyLogging(unittest.TestCase):
resp_body = ''.join(resp)
self._log_parts(log0, should_be_empty=True)
log_parts = self._log_parts(log1)
- self.assertEquals(log_parts[3], 'GET')
- self.assertEquals(log_parts[4], '/')
- self.assertEquals(log_parts[5], 'HTTP/1.0')
- self.assertEquals(log_parts[6], '200')
- self.assertEquals(resp_body, 'FAKE APP')
- self.assertEquals(log_parts[11], str(len(resp_body)))
+ self.assertEqual(log_parts[3], 'GET')
+ self.assertEqual(log_parts[4], '/')
+ self.assertEqual(log_parts[5], 'HTTP/1.0')
+ self.assertEqual(log_parts[6], '200')
+ self.assertEqual(resp_body, 'FAKE APP')
+ self.assertEqual(log_parts[11], str(len(resp_body)))
def test_dual_logging_middlewares_w_inner(self):
@@ -994,20 +994,20 @@ class TestProxyLogging(unittest.TestCase):
# Inner most logger should have logged the app's response
log_parts = self._log_parts(log0)
- self.assertEquals(log_parts[3], 'GET')
- self.assertEquals(log_parts[4], '/')
- self.assertEquals(log_parts[5], 'HTTP/1.0')
- self.assertEquals(log_parts[6], '200')
- self.assertEquals(log_parts[11], str(len('FAKE APP')))
+ self.assertEqual(log_parts[3], 'GET')
+ self.assertEqual(log_parts[4], '/')
+ self.assertEqual(log_parts[5], 'HTTP/1.0')
+ self.assertEqual(log_parts[6], '200')
+ self.assertEqual(log_parts[11], str(len('FAKE APP')))
# Outer most logger should have logged the other middleware's response
log_parts = self._log_parts(log1)
- self.assertEquals(log_parts[3], 'GET')
- self.assertEquals(log_parts[4], '/')
- self.assertEquals(log_parts[5], 'HTTP/1.0')
- self.assertEquals(log_parts[6], '200')
- self.assertEquals(resp_body, 'FAKE MIDDLEWARE')
- self.assertEquals(log_parts[11], str(len(resp_body)))
+ self.assertEqual(log_parts[3], 'GET')
+ self.assertEqual(log_parts[4], '/')
+ self.assertEqual(log_parts[5], 'HTTP/1.0')
+ self.assertEqual(log_parts[6], '200')
+ self.assertEqual(resp_body, 'FAKE MIDDLEWARE')
+ self.assertEqual(log_parts[11], str(len(resp_body)))
def test_policy_index(self):
# Policy index can be specified by X-Backend-Storage-Policy-Index
@@ -1018,7 +1018,7 @@ class TestProxyLogging(unittest.TestCase):
resp = app(req.environ, start_response)
''.join(resp)
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[20], '1')
+ self.assertEqual(log_parts[20], '1')
# Policy index can be specified by X-Backend-Storage-Policy-Index
# in the response header for container API
@@ -1039,7 +1039,7 @@ class TestProxyLogging(unittest.TestCase):
resp = app(req.environ, start_response)
''.join(resp)
log_parts = self._log_parts(app)
- self.assertEquals(log_parts[20], '1')
+ self.assertEqual(log_parts[20], '1')
if __name__ == '__main__':
diff --git a/test/unit/common/middleware/test_quotas.py b/test/unit/common/middleware/test_quotas.py
index 85211257de..b71b78ed83 100644
--- a/test/unit/common/middleware/test_quotas.py
+++ b/test/unit/common/middleware/test_quotas.py
@@ -62,18 +62,18 @@ class TestContainerQuotas(unittest.TestCase):
environ={'REQUEST_METHOD': 'PUT',
'swift.cache': {'key': 'value'}})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_not_handled(self):
app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {})
req = Request.blank('/v1/a/c', environ={'REQUEST_METHOD': 'PUT'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {})
req = Request.blank('/v1/a/c/o', environ={'REQUEST_METHOD': 'GET'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_no_quotas(self):
app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {})
@@ -82,7 +82,7 @@ class TestContainerQuotas(unittest.TestCase):
environ={'REQUEST_METHOD': 'PUT', 'swift.cache': FakeCache({}),
'CONTENT_LENGTH': '100'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_exceed_bytes_quota(self):
app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {})
@@ -92,8 +92,8 @@ class TestContainerQuotas(unittest.TestCase):
environ={'REQUEST_METHOD': 'PUT', 'swift.cache': cache,
'CONTENT_LENGTH': '100'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 413)
- self.assertEquals(res.body, 'Upload exceeds quota.')
+ self.assertEqual(res.status_int, 413)
+ self.assertEqual(res.body, 'Upload exceeds quota.')
def test_exceed_bytes_quota_copy_from(self):
app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {})
@@ -105,8 +105,8 @@ class TestContainerQuotas(unittest.TestCase):
'swift.cache': cache},
headers={'x-copy-from': '/c2/o2'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 413)
- self.assertEquals(res.body, 'Upload exceeds quota.')
+ self.assertEqual(res.status_int, 413)
+ self.assertEqual(res.body, 'Upload exceeds quota.')
def test_exceed_bytes_quota_copy_verb(self):
app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {})
@@ -118,8 +118,8 @@ class TestContainerQuotas(unittest.TestCase):
'swift.cache': cache},
headers={'Destination': '/c/o'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 413)
- self.assertEquals(res.body, 'Upload exceeds quota.')
+ self.assertEqual(res.status_int, 413)
+ self.assertEqual(res.body, 'Upload exceeds quota.')
def test_not_exceed_bytes_quota(self):
app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {})
@@ -129,7 +129,7 @@ class TestContainerQuotas(unittest.TestCase):
environ={'REQUEST_METHOD': 'PUT', 'swift.cache': cache,
'CONTENT_LENGTH': '100'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_not_exceed_bytes_quota_copy_from(self):
app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {})
@@ -140,7 +140,7 @@ class TestContainerQuotas(unittest.TestCase):
'swift.cache': cache},
headers={'x-copy-from': '/c2/o2'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_not_exceed_bytes_quota_copy_verb(self):
app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {})
@@ -151,7 +151,7 @@ class TestContainerQuotas(unittest.TestCase):
'swift.cache': cache},
headers={'Destination': '/c/o'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_bytes_quota_copy_from_no_src(self):
app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {})
@@ -162,7 +162,7 @@ class TestContainerQuotas(unittest.TestCase):
'swift.cache': cache},
headers={'x-copy-from': '/c2/o3'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_bytes_quota_copy_from_bad_src(self):
app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {})
@@ -172,7 +172,7 @@ class TestContainerQuotas(unittest.TestCase):
'swift.cache': cache},
headers={'x-copy-from': 'bad_path'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 412)
+ self.assertEqual(res.status_int, 412)
def test_bytes_quota_copy_verb_no_src(self):
app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {})
@@ -183,7 +183,7 @@ class TestContainerQuotas(unittest.TestCase):
'swift.cache': cache},
headers={'Destination': '/c/o'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_exceed_counts_quota(self):
app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {})
@@ -193,8 +193,8 @@ class TestContainerQuotas(unittest.TestCase):
environ={'REQUEST_METHOD': 'PUT', 'swift.cache': cache,
'CONTENT_LENGTH': '100'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 413)
- self.assertEquals(res.body, 'Upload exceeds quota.')
+ self.assertEqual(res.status_int, 413)
+ self.assertEqual(res.body, 'Upload exceeds quota.')
def test_exceed_counts_quota_copy_from(self):
app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {})
@@ -205,8 +205,8 @@ class TestContainerQuotas(unittest.TestCase):
'swift.cache': cache},
headers={'x-copy-from': '/c2/o2'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 413)
- self.assertEquals(res.body, 'Upload exceeds quota.')
+ self.assertEqual(res.status_int, 413)
+ self.assertEqual(res.body, 'Upload exceeds quota.')
def test_exceed_counts_quota_copy_verb(self):
app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {})
@@ -216,8 +216,8 @@ class TestContainerQuotas(unittest.TestCase):
'swift.cache': cache},
headers={'Destination': '/c/o'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 413)
- self.assertEquals(res.body, 'Upload exceeds quota.')
+ self.assertEqual(res.status_int, 413)
+ self.assertEqual(res.body, 'Upload exceeds quota.')
def test_exceed_counts_quota_copy_cross_account_verb(self):
app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {})
@@ -232,8 +232,8 @@ class TestContainerQuotas(unittest.TestCase):
headers={'Destination': '/c/o',
'Destination-Account': 'a2'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 413)
- self.assertEquals(res.body, 'Upload exceeds quota.')
+ self.assertEqual(res.status_int, 413)
+ self.assertEqual(res.body, 'Upload exceeds quota.')
def test_exceed_counts_quota_copy_cross_account_PUT_verb(self):
app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {})
@@ -248,8 +248,8 @@ class TestContainerQuotas(unittest.TestCase):
headers={'X-Copy-From': '/c2/o2',
'X-Copy-From-Account': 'a'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 413)
- self.assertEquals(res.body, 'Upload exceeds quota.')
+ self.assertEqual(res.status_int, 413)
+ self.assertEqual(res.body, 'Upload exceeds quota.')
def test_not_exceed_counts_quota(self):
app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {})
@@ -259,7 +259,7 @@ class TestContainerQuotas(unittest.TestCase):
environ={'REQUEST_METHOD': 'PUT', 'swift.cache': cache,
'CONTENT_LENGTH': '100'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_not_exceed_counts_quota_copy_from(self):
app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {})
@@ -269,7 +269,7 @@ class TestContainerQuotas(unittest.TestCase):
'swift.cache': cache},
headers={'x-copy-from': '/c2/o2'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_not_exceed_counts_quota_copy_verb(self):
app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {})
@@ -279,7 +279,7 @@ class TestContainerQuotas(unittest.TestCase):
'swift.cache': cache},
headers={'Destination': '/c/o'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_invalid_quotas(self):
req = Request.blank(
@@ -288,7 +288,7 @@ class TestContainerQuotas(unittest.TestCase):
'HTTP_X_CONTAINER_META_QUOTA_BYTES': 'abc'})
res = req.get_response(
container_quotas.ContainerQuotaMiddleware(FakeApp(), {}))
- self.assertEquals(res.status_int, 400)
+ self.assertEqual(res.status_int, 400)
req = Request.blank(
'/v1/a/c',
@@ -296,7 +296,7 @@ class TestContainerQuotas(unittest.TestCase):
'HTTP_X_CONTAINER_META_QUOTA_COUNT': 'abc'})
res = req.get_response(
container_quotas.ContainerQuotaMiddleware(FakeApp(), {}))
- self.assertEquals(res.status_int, 400)
+ self.assertEqual(res.status_int, 400)
def test_valid_quotas(self):
req = Request.blank(
@@ -305,7 +305,7 @@ class TestContainerQuotas(unittest.TestCase):
'HTTP_X_CONTAINER_META_QUOTA_BYTES': '123'})
res = req.get_response(
container_quotas.ContainerQuotaMiddleware(FakeApp(), {}))
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
req = Request.blank(
'/v1/a/c',
@@ -313,7 +313,7 @@ class TestContainerQuotas(unittest.TestCase):
'HTTP_X_CONTAINER_META_QUOTA_COUNT': '123'})
res = req.get_response(
container_quotas.ContainerQuotaMiddleware(FakeApp(), {}))
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_delete_quotas(self):
req = Request.blank(
@@ -322,7 +322,7 @@ class TestContainerQuotas(unittest.TestCase):
'HTTP_X_CONTAINER_META_QUOTA_BYTES': None})
res = req.get_response(
container_quotas.ContainerQuotaMiddleware(FakeApp(), {}))
- self.assertEquals(res.status_int, 200)
+ self.assertEqual(res.status_int, 200)
def test_missing_container(self):
app = container_quotas.ContainerQuotaMiddleware(FakeMissingApp(), {})
@@ -332,7 +332,7 @@ class TestContainerQuotas(unittest.TestCase):
environ={'REQUEST_METHOD': 'PUT', 'swift.cache': cache,
'CONTENT_LENGTH': '100'})
res = req.get_response(app)
- self.assertEquals(res.status_int, 404)
+ self.assertEqual(res.status_int, 404)
def test_auth_fail(self):
app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {})
@@ -344,7 +344,7 @@ class TestContainerQuotas(unittest.TestCase):
'CONTENT_LENGTH': '100',
'swift.authorize': lambda *args: HTTPUnauthorized()})
res = req.get_response(app)
- self.assertEquals(res.status_int, 401)
+ self.assertEqual(res.status_int, 401)
if __name__ == '__main__':
unittest.main()
diff --git a/test/unit/common/middleware/test_ratelimit.py b/test/unit/common/middleware/test_ratelimit.py
index eb9f5e41ac..2d865f5b50 100644
--- a/test/unit/common/middleware/test_ratelimit.py
+++ b/test/unit/common/middleware/test_ratelimit.py
@@ -159,7 +159,7 @@ class TestRateLimit(unittest.TestCase):
# Allow for one second of variation in the total time.
time_diff = abs(total_time - (end - begin))
if check_time:
- self.assertEquals(round(total_time, 1), round(time_ticker, 1))
+ self.assertEqual(round(total_time, 1), round(time_ticker, 1))
return time_diff
def test_get_maxrate(self):
@@ -168,15 +168,15 @@ class TestRateLimit(unittest.TestCase):
'container_ratelimit_75': 30}
test_ratelimit = ratelimit.filter_factory(conf_dict)(FakeApp())
test_ratelimit.logger = FakeLogger()
- self.assertEquals(ratelimit.get_maxrate(
+ self.assertEqual(ratelimit.get_maxrate(
test_ratelimit.container_ratelimits, 0), None)
- self.assertEquals(ratelimit.get_maxrate(
+ self.assertEqual(ratelimit.get_maxrate(
test_ratelimit.container_ratelimits, 5), None)
- self.assertEquals(ratelimit.get_maxrate(
+ self.assertEqual(ratelimit.get_maxrate(
test_ratelimit.container_ratelimits, 10), 200)
- self.assertEquals(ratelimit.get_maxrate(
+ self.assertEqual(ratelimit.get_maxrate(
test_ratelimit.container_ratelimits, 60), 72)
- self.assertEquals(ratelimit.get_maxrate(
+ self.assertEqual(ratelimit.get_maxrate(
test_ratelimit.container_ratelimits, 160), 30)
def test_get_ratelimitable_key_tuples(self):
@@ -193,35 +193,35 @@ class TestRateLimit(unittest.TestCase):
with mock.patch('swift.common.middleware.ratelimit.get_account_info',
lambda *args, **kwargs: {}):
req.method = 'DELETE'
- self.assertEquals(len(the_app.get_ratelimitable_key_tuples(
+ self.assertEqual(len(the_app.get_ratelimitable_key_tuples(
req, 'a', None, None)), 0)
req.method = 'PUT'
- self.assertEquals(len(the_app.get_ratelimitable_key_tuples(
+ self.assertEqual(len(the_app.get_ratelimitable_key_tuples(
req, 'a', 'c', None)), 1)
req.method = 'DELETE'
- self.assertEquals(len(the_app.get_ratelimitable_key_tuples(
+ self.assertEqual(len(the_app.get_ratelimitable_key_tuples(
req, 'a', 'c', None)), 1)
req.method = 'GET'
- self.assertEquals(len(the_app.get_ratelimitable_key_tuples(
+ self.assertEqual(len(the_app.get_ratelimitable_key_tuples(
req, 'a', 'c', 'o')), 0)
req.method = 'PUT'
- self.assertEquals(len(the_app.get_ratelimitable_key_tuples(
+ self.assertEqual(len(the_app.get_ratelimitable_key_tuples(
req, 'a', 'c', 'o')), 1)
req.method = 'PUT'
- self.assertEquals(len(the_app.get_ratelimitable_key_tuples(
+ self.assertEqual(len(the_app.get_ratelimitable_key_tuples(
req, 'a', 'c', None, global_ratelimit=10)), 2)
- self.assertEquals(the_app.get_ratelimitable_key_tuples(
+ self.assertEqual(the_app.get_ratelimitable_key_tuples(
req, 'a', 'c', None, global_ratelimit=10)[1],
('ratelimit/global-write/a', 10))
req.method = 'PUT'
- self.assertEquals(len(the_app.get_ratelimitable_key_tuples(
+ self.assertEqual(len(the_app.get_ratelimitable_key_tuples(
req, 'a', 'c', None, global_ratelimit='notafloat')), 1)
def test_memcached_container_info_dict(self):
mdict = headers_to_container_info({'x-container-object-count': '45'})
- self.assertEquals(mdict['object_count'], '45')
+ self.assertEqual(mdict['object_count'], '45')
def test_ratelimit_old_memcache_format(self):
current_rate = 13
@@ -238,7 +238,7 @@ class TestRateLimit(unittest.TestCase):
with mock.patch('swift.common.middleware.ratelimit.get_account_info',
lambda *args, **kwargs: {}):
tuples = the_app.get_ratelimitable_key_tuples(req, 'a', 'c', 'o')
- self.assertEquals(tuples, [('ratelimit/a/c', 200.0)])
+ self.assertEqual(tuples, [('ratelimit/a/c', 200.0)])
def test_account_ratelimit(self):
current_rate = 5
@@ -261,7 +261,7 @@ class TestRateLimit(unittest.TestCase):
begin = time.time()
self._run(make_app_call, num_calls, current_rate,
check_time=bool(exp_time))
- self.assertEquals(round(time.time() - begin, 1), exp_time)
+ self.assertEqual(round(time.time() - begin, 1), exp_time)
self._reset_time()
def test_ratelimit_set_incr(self):
@@ -280,7 +280,7 @@ class TestRateLimit(unittest.TestCase):
with mock.patch('swift.common.middleware.ratelimit.get_account_info',
lambda *args, **kwargs: {}):
self._run(make_app_call, num_calls, current_rate, check_time=False)
- self.assertEquals(round(time.time() - begin, 1), 9.8)
+ self.assertEqual(round(time.time() - begin, 1), 9.8)
def test_ratelimit_old_white_black_list(self):
global time_ticker
@@ -339,8 +339,8 @@ class TestRateLimit(unittest.TestCase):
the_498s = [
t for t in threads
if ''.join(t.result).startswith('Slow down')]
- self.assertEquals(len(the_498s), 0)
- self.assertEquals(time_ticker, 0)
+ self.assertEqual(len(the_498s), 0)
+ self.assertEqual(time_ticker, 0)
def test_ratelimit_blacklist(self):
global time_ticker
@@ -382,8 +382,8 @@ class TestRateLimit(unittest.TestCase):
the_497s = [
t for t in threads
if ''.join(t.result).startswith('Your account')]
- self.assertEquals(len(the_497s), 5)
- self.assertEquals(time_ticker, 0)
+ self.assertEqual(len(the_497s), 5)
+ self.assertEqual(time_ticker, 0)
def test_ratelimit_max_rate_double(self):
global time_ticker
@@ -408,13 +408,13 @@ class TestRateLimit(unittest.TestCase):
r = self.test_ratelimit(req.environ, start_response)
mock_sleep(.1)
r = self.test_ratelimit(req.environ, start_response)
- self.assertEquals(r[0], 'Slow down')
+ self.assertEqual(r[0], 'Slow down')
mock_sleep(.1)
r = self.test_ratelimit(req.environ, start_response)
- self.assertEquals(r[0], 'Slow down')
+ self.assertEqual(r[0], 'Slow down')
mock_sleep(.1)
r = self.test_ratelimit(req.environ, start_response)
- self.assertEquals(r[0], '204 No Content')
+ self.assertEqual(r[0], '204 No Content')
def test_ratelimit_max_rate_double_container(self):
global time_ticker
@@ -442,13 +442,13 @@ class TestRateLimit(unittest.TestCase):
r = self.test_ratelimit(req.environ, start_response)
mock_sleep(.1)
r = self.test_ratelimit(req.environ, start_response)
- self.assertEquals(r[0], 'Slow down')
+ self.assertEqual(r[0], 'Slow down')
mock_sleep(.1)
r = self.test_ratelimit(req.environ, start_response)
- self.assertEquals(r[0], 'Slow down')
+ self.assertEqual(r[0], 'Slow down')
mock_sleep(.1)
r = self.test_ratelimit(req.environ, start_response)
- self.assertEquals(r[0], '204 No Content')
+ self.assertEqual(r[0], '204 No Content')
def test_ratelimit_max_rate_double_container_listing(self):
global time_ticker
@@ -476,17 +476,17 @@ class TestRateLimit(unittest.TestCase):
r = self.test_ratelimit(req.environ, start_response)
mock_sleep(.1)
r = self.test_ratelimit(req.environ, start_response)
- self.assertEquals(r[0], 'Slow down')
+ self.assertEqual(r[0], 'Slow down')
mock_sleep(.1)
r = self.test_ratelimit(req.environ, start_response)
- self.assertEquals(r[0], 'Slow down')
+ self.assertEqual(r[0], 'Slow down')
mock_sleep(.1)
r = self.test_ratelimit(req.environ, start_response)
- self.assertEquals(r[0], '204 No Content')
+ self.assertEqual(r[0], '204 No Content')
mc = self.test_ratelimit.memcache_client
try:
self.test_ratelimit.memcache_client = None
- self.assertEquals(
+ self.assertEqual(
self.test_ratelimit.handle_ratelimit(req, 'n', 'c', None),
None)
finally:
@@ -529,7 +529,7 @@ class TestRateLimit(unittest.TestCase):
thread.join()
time_took = time.time() - begin
- self.assertEquals(1.5, round(time_took, 1))
+ self.assertEqual(1.5, round(time_took, 1))
def test_call_invalid_path(self):
env = {'REQUEST_METHOD': 'GET',
@@ -563,7 +563,7 @@ class TestRateLimit(unittest.TestCase):
begin = time.time()
self._run(make_app_call, num_calls, current_rate, check_time=False)
time_took = time.time() - begin
- self.assertEquals(round(time_took, 1), 0) # no memcache, no limiting
+ self.assertEqual(round(time_took, 1), 0) # no memcache, no limiting
def test_restarting_memcache(self):
current_rate = 2
@@ -582,7 +582,7 @@ class TestRateLimit(unittest.TestCase):
lambda *args, **kwargs: {}):
self._run(make_app_call, num_calls, current_rate, check_time=False)
time_took = time.time() - begin
- self.assertEquals(round(time_took, 1), 0) # no memcache, no limit
+ self.assertEqual(round(time_took, 1), 0) # no memcache, no limit
class TestSwiftInfo(unittest.TestCase):
diff --git a/test/unit/common/middleware/test_recon.py b/test/unit/common/middleware/test_recon.py
index 1dedec688c..049a60c2c8 100644
--- a/test/unit/common/middleware/test_recon.py
+++ b/test/unit/common/middleware/test_recon.py
@@ -310,8 +310,8 @@ class TestReconSuccess(TestCase):
# object-{1,2}.ring.gz should both appear as they are present on disk
# and were configured as policies.
app = recon.ReconMiddleware(FakeApp(), {'swift_dir': self.tempdir})
- self.assertEquals(sorted(app.get_ring_md5().items()),
- sorted(expt_out.items()))
+ self.assertEqual(sorted(app.get_ring_md5().items()),
+ sorted(expt_out.items()))
def test_get_ring_md5_ioerror_produces_none_hash(self):
# Ring files that are present but produce an IOError on read should
@@ -326,8 +326,8 @@ class TestReconSuccess(TestCase):
'%s/container.ring.gz' % self.tempdir: None,
'%s/object.ring.gz' % self.tempdir: None}
ringmd5 = self.app.get_ring_md5(openr=fake_open)
- self.assertEquals(sorted(ringmd5.items()),
- sorted(expt_out.items()))
+ self.assertEqual(sorted(ringmd5.items()),
+ sorted(expt_out.items()))
def test_get_ring_md5_failed_ring_hash_recovers_without_restart(self):
# Ring files that are present but produce an IOError on read will
@@ -341,8 +341,8 @@ class TestReconSuccess(TestCase):
'%s/container.ring.gz' % self.tempdir: None,
'%s/object.ring.gz' % self.tempdir: None}
ringmd5 = self.app.get_ring_md5(openr=fake_open)
- self.assertEquals(sorted(ringmd5.items()),
- sorted(expt_out.items()))
+ self.assertEqual(sorted(ringmd5.items()),
+ sorted(expt_out.items()))
# If we fix a ring and it can be read again, its hash should then
# appear using the same app instance
@@ -356,8 +356,8 @@ class TestReconSuccess(TestCase):
'%s/object.ring.gz' % self.tempdir:
'da02bfbd0bf1e7d56faea15b6fe5ab1e'}
ringmd5 = self.app.get_ring_md5(openr=fake_open_objonly)
- self.assertEquals(sorted(ringmd5.items()),
- sorted(expt_out.items()))
+ self.assertEqual(sorted(ringmd5.items()),
+ sorted(expt_out.items()))
@patch_policies([
StoragePolicy(0, 'stagecoach'),
@@ -382,8 +382,8 @@ class TestReconSuccess(TestCase):
# object-3502.ring.gz should not appear as it's configured but not
# present.
app = recon.ReconMiddleware(FakeApp(), {'swift_dir': self.tempdir})
- self.assertEquals(sorted(app.get_ring_md5().items()),
- sorted(expt_out.items()))
+ self.assertEqual(sorted(app.get_ring_md5().items()),
+ sorted(expt_out.items()))
# Simulate the configured policy's missing ringfile being moved into
# place during runtime
@@ -398,8 +398,8 @@ class TestReconSuccess(TestCase):
# We should now see it in the ringmd5 response, without a restart
# (using the same app instance)
- self.assertEquals(sorted(app.get_ring_md5().items()),
- sorted(expt_out.items()))
+ self.assertEqual(sorted(app.get_ring_md5().items()),
+ sorted(expt_out.items()))
@patch_policies([
StoragePolicy(0, 'stagecoach', is_default=True),
@@ -423,8 +423,8 @@ class TestReconSuccess(TestCase):
# object-2305.ring.gz should not appear as it's configured but not
# present.
app = recon.ReconMiddleware(FakeApp(), {'swift_dir': self.tempdir})
- self.assertEquals(sorted(app.get_ring_md5().items()),
- sorted(expt_out.items()))
+ self.assertEqual(sorted(app.get_ring_md5().items()),
+ sorted(expt_out.items()))
@patch_policies([
StoragePolicy(0, 'zero', is_default=True),
@@ -443,17 +443,17 @@ class TestReconSuccess(TestCase):
# object-{1,2}.ring.gz should not appear as they are present on disk
# but were not configured as policies.
app = recon.ReconMiddleware(FakeApp(), {'swift_dir': self.tempdir})
- self.assertEquals(sorted(app.get_ring_md5().items()),
- sorted(expt_out.items()))
+ self.assertEqual(sorted(app.get_ring_md5().items()),
+ sorted(expt_out.items()))
def test_from_recon_cache(self):
oart = OpenAndReadTester(['{"notneeded": 5, "testkey1": "canhazio"}'])
self.app._from_recon_cache = self.real_from_cache
rv = self.app._from_recon_cache(['testkey1', 'notpresentkey'],
'test.cache', openr=oart.open)
- self.assertEquals(oart.read_calls, [((), {})])
- self.assertEquals(oart.open_calls, [(('test.cache', 'r'), {})])
- self.assertEquals(rv, {'notpresentkey': None, 'testkey1': 'canhazio'})
+ self.assertEqual(oart.read_calls, [((), {})])
+ self.assertEqual(oart.open_calls, [(('test.cache', 'r'), {})])
+ self.assertEqual(rv, {'notpresentkey': None, 'testkey1': 'canhazio'})
self.app._from_recon_cache = self.fakecache.fake_from_recon_cache
def test_from_recon_cache_ioerror(self):
@@ -461,7 +461,7 @@ class TestReconSuccess(TestCase):
self.app._from_recon_cache = self.real_from_cache
rv = self.app._from_recon_cache(['testkey1', 'notpresentkey'],
'test.cache', openr=oart)
- self.assertEquals(rv, {'notpresentkey': None, 'testkey1': None})
+ self.assertEqual(rv, {'notpresentkey': None, 'testkey1': None})
self.app._from_recon_cache = self.fakecache.fake_from_recon_cache
def test_from_recon_cache_valueerror(self):
@@ -469,7 +469,7 @@ class TestReconSuccess(TestCase):
self.app._from_recon_cache = self.real_from_cache
rv = self.app._from_recon_cache(['testkey1', 'notpresentkey'],
'test.cache', openr=oart)
- self.assertEquals(rv, {'notpresentkey': None, 'testkey1': None})
+ self.assertEqual(rv, {'notpresentkey': None, 'testkey1': None})
self.app._from_recon_cache = self.fakecache.fake_from_recon_cache
def test_from_recon_cache_exception(self):
@@ -477,7 +477,7 @@ class TestReconSuccess(TestCase):
self.app._from_recon_cache = self.real_from_cache
rv = self.app._from_recon_cache(['testkey1', 'notpresentkey'],
'test.cache', openr=oart)
- self.assertEquals(rv, {'notpresentkey': None, 'testkey1': None})
+ self.assertEqual(rv, {'notpresentkey': None, 'testkey1': None})
self.app._from_recon_cache = self.fakecache.fake_from_recon_cache
def test_get_mounted(self):
@@ -525,17 +525,17 @@ class TestReconSuccess(TestCase):
{'device': 'none', 'path': '/proc/fs/vmblock/mountPoint'}]
oart = OpenAndReadTester(mounts_content)
rv = self.app.get_mounted(openr=oart.open)
- self.assertEquals(oart.open_calls, [(('/proc/mounts', 'r'), {})])
- self.assertEquals(rv, mounted_resp)
+ self.assertEqual(oart.open_calls, [(('/proc/mounts', 'r'), {})])
+ self.assertEqual(rv, mounted_resp)
def test_get_load(self):
oart = OpenAndReadTester(['0.03 0.03 0.00 1/220 16306'])
rv = self.app.get_load(openr=oart.open)
- self.assertEquals(oart.read_calls, [((), {})])
- self.assertEquals(oart.open_calls, [(('/proc/loadavg', 'r'), {})])
- self.assertEquals(rv, {'5m': 0.029999999999999999, '15m': 0.0,
- 'processes': 16306, 'tasks': '1/220',
- '1m': 0.029999999999999999})
+ self.assertEqual(oart.read_calls, [((), {})])
+ self.assertEqual(oart.open_calls, [(('/proc/loadavg', 'r'), {})])
+ self.assertEqual(rv, {'5m': 0.029999999999999999, '15m': 0.0,
+ 'processes': 16306, 'tasks': '1/220',
+ '1m': 0.029999999999999999})
def test_get_mem(self):
meminfo_content = ['MemTotal: 505840 kB',
@@ -623,17 +623,17 @@ class TestReconSuccess(TestCase):
'Dirty': '104 kB'}
oart = OpenAndReadTester(meminfo_content)
rv = self.app.get_mem(openr=oart.open)
- self.assertEquals(oart.open_calls, [(('/proc/meminfo', 'r'), {})])
- self.assertEquals(rv, meminfo_resp)
+ self.assertEqual(oart.open_calls, [(('/proc/meminfo', 'r'), {})])
+ self.assertEqual(rv, meminfo_resp)
def test_get_async_info(self):
from_cache_response = {'async_pending': 5}
self.fakecache.fakeout = from_cache_response
rv = self.app.get_async_info()
- self.assertEquals(self.fakecache.fakeout_calls,
- [((['async_pending'],
- '/var/cache/swift/object.recon'), {})])
- self.assertEquals(rv, {'async_pending': 5})
+ self.assertEqual(self.fakecache.fakeout_calls,
+ [((['async_pending'],
+ '/var/cache/swift/object.recon'), {})])
+ self.assertEqual(rv, {'async_pending': 5})
def test_get_replication_info_account(self):
from_cache_response = {
@@ -652,11 +652,11 @@ class TestReconSuccess(TestCase):
"replication_last": 1357969645.25}
self.fakecache.fakeout = from_cache_response
rv = self.app.get_replication_info('account')
- self.assertEquals(self.fakecache.fakeout_calls,
- [((['replication_time', 'replication_stats',
- 'replication_last'],
- '/var/cache/swift/account.recon'), {})])
- self.assertEquals(rv, {
+ self.assertEqual(self.fakecache.fakeout_calls,
+ [((['replication_time', 'replication_stats',
+ 'replication_last'],
+ '/var/cache/swift/account.recon'), {})])
+ self.assertEqual(rv, {
"replication_stats": {
"attempted": 1, "diff": 0,
"diff_capped": 0, "empty": 0,
@@ -689,11 +689,11 @@ class TestReconSuccess(TestCase):
self.fakecache.fakeout_calls = []
self.fakecache.fakeout = from_cache_response
rv = self.app.get_replication_info('container')
- self.assertEquals(self.fakecache.fakeout_calls,
- [((['replication_time', 'replication_stats',
- 'replication_last'],
- '/var/cache/swift/container.recon'), {})])
- self.assertEquals(rv, {
+ self.assertEqual(self.fakecache.fakeout_calls,
+ [((['replication_time', 'replication_stats',
+ 'replication_last'],
+ '/var/cache/swift/container.recon'), {})])
+ self.assertEqual(rv, {
"replication_time": 200.0,
"replication_stats": {
"attempted": 179, "diff": 0,
@@ -725,12 +725,12 @@ class TestReconSuccess(TestCase):
self.fakecache.fakeout_calls = []
self.fakecache.fakeout = from_cache_response
rv = self.app.get_replication_info('object')
- self.assertEquals(self.fakecache.fakeout_calls,
- [((['replication_time', 'replication_stats',
- 'replication_last', 'object_replication_time',
- 'object_replication_last'],
- '/var/cache/swift/object.recon'), {})])
- self.assertEquals(rv, {
+ self.assertEqual(self.fakecache.fakeout_calls,
+ [((['replication_time', 'replication_stats',
+ 'replication_last', 'object_replication_time',
+ 'object_replication_last'],
+ '/var/cache/swift/object.recon'), {})])
+ self.assertEqual(rv, {
"replication_time": 0.2615511417388916,
"replication_stats": {
"attempted": 179,
@@ -749,20 +749,20 @@ class TestReconSuccess(TestCase):
self.fakecache.fakeout_calls = []
self.fakecache.fakeout = from_cache_response
rv = self.app.get_updater_info('container')
- self.assertEquals(self.fakecache.fakeout_calls,
- [((['container_updater_sweep'],
- '/var/cache/swift/container.recon'), {})])
- self.assertEquals(rv, {"container_updater_sweep": 18.476239919662476})
+ self.assertEqual(self.fakecache.fakeout_calls,
+ [((['container_updater_sweep'],
+ '/var/cache/swift/container.recon'), {})])
+ self.assertEqual(rv, {"container_updater_sweep": 18.476239919662476})
def test_get_updater_info_object(self):
from_cache_response = {"object_updater_sweep": 0.79848217964172363}
self.fakecache.fakeout_calls = []
self.fakecache.fakeout = from_cache_response
rv = self.app.get_updater_info('object')
- self.assertEquals(self.fakecache.fakeout_calls,
- [((['object_updater_sweep'],
- '/var/cache/swift/object.recon'), {})])
- self.assertEquals(rv, {"object_updater_sweep": 0.79848217964172363})
+ self.assertEqual(self.fakecache.fakeout_calls,
+ [((['object_updater_sweep'],
+ '/var/cache/swift/object.recon'), {})])
+ self.assertEqual(rv, {"object_updater_sweep": 0.79848217964172363})
def test_get_expirer_info_object(self):
from_cache_response = {'object_expiration_pass': 0.79848217964172363,
@@ -770,10 +770,10 @@ class TestReconSuccess(TestCase):
self.fakecache.fakeout_calls = []
self.fakecache.fakeout = from_cache_response
rv = self.app.get_expirer_info('object')
- self.assertEquals(self.fakecache.fakeout_calls,
- [((['object_expiration_pass', 'expired_last_pass'],
- '/var/cache/swift/object.recon'), {})])
- self.assertEquals(rv, from_cache_response)
+ self.assertEqual(self.fakecache.fakeout_calls,
+ [((['object_expiration_pass', 'expired_last_pass'],
+ '/var/cache/swift/object.recon'), {})])
+ self.assertEqual(rv, from_cache_response)
def test_get_auditor_info_account(self):
from_cache_response = {"account_auditor_pass_completed": 0.24,
@@ -783,16 +783,16 @@ class TestReconSuccess(TestCase):
self.fakecache.fakeout_calls = []
self.fakecache.fakeout = from_cache_response
rv = self.app.get_auditor_info('account')
- self.assertEquals(self.fakecache.fakeout_calls,
- [((['account_audits_passed',
- 'account_auditor_pass_completed',
- 'account_audits_since',
- 'account_audits_failed'],
- '/var/cache/swift/account.recon'), {})])
- self.assertEquals(rv, {"account_auditor_pass_completed": 0.24,
- "account_audits_failed": 0,
- "account_audits_passed": 6,
- "account_audits_since": "1333145374.1373529"})
+ self.assertEqual(self.fakecache.fakeout_calls,
+ [((['account_audits_passed',
+ 'account_auditor_pass_completed',
+ 'account_audits_since',
+ 'account_audits_failed'],
+ '/var/cache/swift/account.recon'), {})])
+ self.assertEqual(rv, {"account_auditor_pass_completed": 0.24,
+ "account_audits_failed": 0,
+ "account_audits_passed": 6,
+ "account_audits_since": "1333145374.1373529"})
def test_get_auditor_info_container(self):
from_cache_response = {"container_auditor_pass_completed": 0.24,
@@ -802,16 +802,16 @@ class TestReconSuccess(TestCase):
self.fakecache.fakeout_calls = []
self.fakecache.fakeout = from_cache_response
rv = self.app.get_auditor_info('container')
- self.assertEquals(self.fakecache.fakeout_calls,
- [((['container_audits_passed',
- 'container_auditor_pass_completed',
- 'container_audits_since',
- 'container_audits_failed'],
- '/var/cache/swift/container.recon'), {})])
- self.assertEquals(rv, {"container_auditor_pass_completed": 0.24,
- "container_audits_failed": 0,
- "container_audits_passed": 6,
- "container_audits_since": "1333145374.1373529"})
+ self.assertEqual(self.fakecache.fakeout_calls,
+ [((['container_audits_passed',
+ 'container_auditor_pass_completed',
+ 'container_audits_since',
+ 'container_audits_failed'],
+ '/var/cache/swift/container.recon'), {})])
+ self.assertEqual(rv, {"container_auditor_pass_completed": 0.24,
+ "container_audits_failed": 0,
+ "container_audits_passed": 6,
+ "container_audits_since": "1333145374.1373529"})
def test_get_auditor_info_object(self):
from_cache_response = {
@@ -832,11 +832,11 @@ class TestReconSuccess(TestCase):
self.fakecache.fakeout_calls = []
self.fakecache.fakeout = from_cache_response
rv = self.app.get_auditor_info('object')
- self.assertEquals(self.fakecache.fakeout_calls,
- [((['object_auditor_stats_ALL',
- 'object_auditor_stats_ZBF'],
- '/var/cache/swift/object.recon'), {})])
- self.assertEquals(rv, {
+ self.assertEqual(self.fakecache.fakeout_calls,
+ [((['object_auditor_stats_ALL',
+ 'object_auditor_stats_ZBF'],
+ '/var/cache/swift/object.recon'), {})])
+ self.assertEqual(rv, {
"object_auditor_stats_ALL": {
"audit_time": 115.14418768882751,
"bytes_processed": 234660,
@@ -879,11 +879,11 @@ class TestReconSuccess(TestCase):
self.fakecache.fakeout_calls = []
self.fakecache.fakeout = from_cache_response
rv = self.app.get_auditor_info('object')
- self.assertEquals(self.fakecache.fakeout_calls,
- [((['object_auditor_stats_ALL',
- 'object_auditor_stats_ZBF'],
- '/var/cache/swift/object.recon'), {})])
- self.assertEquals(rv, {
+ self.assertEqual(self.fakecache.fakeout_calls,
+ [((['object_auditor_stats_ALL',
+ 'object_auditor_stats_ZBF'],
+ '/var/cache/swift/object.recon'), {})])
+ self.assertEqual(rv, {
"object_auditor_stats_ALL": {
'disk1': {
"audit_time": 115.14418768882751,
@@ -913,26 +913,26 @@ class TestReconSuccess(TestCase):
self.mockos.ls_output = ['fakeone', 'faketwo']
self.mockos.ismount_output = False
rv = self.app.get_unmounted()
- self.assertEquals(self.mockos.listdir_calls, [(('/srv/node',), {})])
- self.assertEquals(rv, unmounted_resp)
+ self.assertEqual(self.mockos.listdir_calls, [(('/srv/node',), {})])
+ self.assertEqual(rv, unmounted_resp)
def test_get_unmounted_everything_normal(self):
unmounted_resp = []
self.mockos.ls_output = ['fakeone', 'faketwo']
self.mockos.ismount_output = True
rv = self.app.get_unmounted()
- self.assertEquals(self.mockos.listdir_calls, [(('/srv/node',), {})])
- self.assertEquals(rv, unmounted_resp)
+ self.assertEqual(self.mockos.listdir_calls, [(('/srv/node',), {})])
+ self.assertEqual(rv, unmounted_resp)
def test_get_unmounted_checkmount_fail(self):
unmounted_resp = [{'device': 'fakeone', 'mounted': 'brokendrive'}]
self.mockos.ls_output = ['fakeone']
self.mockos.ismount_output = OSError('brokendrive')
rv = self.app.get_unmounted()
- self.assertEquals(self.mockos.listdir_calls, [(('/srv/node',), {})])
- self.assertEquals(self.mockos.ismount_calls,
- [(('/srv/node/fakeone',), {})])
- self.assertEquals(rv, unmounted_resp)
+ self.assertEqual(self.mockos.listdir_calls, [(('/srv/node',), {})])
+ self.assertEqual(self.mockos.ismount_calls,
+ [(('/srv/node/fakeone',), {})])
+ self.assertEqual(rv, unmounted_resp)
def test_no_get_unmounted(self):
@@ -943,8 +943,8 @@ class TestReconSuccess(TestCase):
self.mockos.ls_output = []
self.mockos.ismount_output = False
rv = self.app.get_unmounted()
- self.assertEquals(self.mockos.listdir_calls, [(('/srv/node',), {})])
- self.assertEquals(rv, unmounted_resp)
+ self.assertEqual(self.mockos.listdir_calls, [(('/srv/node',), {})])
+ self.assertEqual(rv, unmounted_resp)
def test_get_diskusage(self):
# posix.statvfs_result(f_bsize=4096, f_frsize=4096, f_blocks=1963185,
@@ -960,9 +960,9 @@ class TestReconSuccess(TestCase):
self.mockos.statvfs_output = statvfs_content
self.mockos.ismount_output = True
rv = self.app.get_diskusage()
- self.assertEquals(self.mockos.statvfs_calls,
- [(('/srv/node/canhazdrive1',), {})])
- self.assertEquals(rv, du_resp)
+ self.assertEqual(self.mockos.statvfs_calls,
+ [(('/srv/node/canhazdrive1',), {})])
+ self.assertEqual(rv, du_resp)
def test_get_diskusage_checkmount_fail(self):
du_resp = [{'device': 'canhazdrive1', 'avail': '',
@@ -970,10 +970,10 @@ class TestReconSuccess(TestCase):
self.mockos.ls_output = ['canhazdrive1']
self.mockos.ismount_output = OSError('brokendrive')
rv = self.app.get_diskusage()
- self.assertEquals(self.mockos.listdir_calls, [(('/srv/node',), {})])
- self.assertEquals(self.mockos.ismount_calls,
- [(('/srv/node/canhazdrive1',), {})])
- self.assertEquals(rv, du_resp)
+ self.assertEqual(self.mockos.listdir_calls, [(('/srv/node',), {})])
+ self.assertEqual(self.mockos.ismount_calls,
+ [(('/srv/node/canhazdrive1',), {})])
+ self.assertEqual(rv, du_resp)
@mock.patch("swift.common.middleware.recon.check_mount", fake_check_mount)
def test_get_diskusage_oserror(self):
@@ -981,7 +981,7 @@ class TestReconSuccess(TestCase):
'mounted': 'Input/Output Error', 'used': '', 'size': ''}]
self.mockos.ls_output = ['canhazdrive1']
rv = self.app.get_diskusage()
- self.assertEquals(rv, du_resp)
+ self.assertEqual(rv, du_resp)
def test_get_quarantine_count(self):
dirs = [['sda'], ['accounts', 'containers', 'objects', 'objects-1']]
@@ -1003,9 +1003,9 @@ class TestReconSuccess(TestCase):
with mock.patch("os.path.exists", fake_exists):
with mock.patch("os.listdir", fake_listdir):
rv = self.app.get_quarantine_count()
- self.assertEquals(rv, {'objects': 4, 'accounts': 2, 'policies':
- {'1': {'objects': 2}, '0': {'objects': 2}},
- 'containers': 2})
+ self.assertEqual(rv, {'objects': 4, 'accounts': 2, 'policies':
+ {'1': {'objects': 2}, '0': {'objects': 2}},
+ 'containers': 2})
def test_get_socket_info(self):
sockstat_content = ['sockets: used 271',
@@ -1015,7 +1015,7 @@ class TestReconSuccess(TestCase):
'']
oart = OpenAndReadTester(sockstat_content)
self.app.get_socket_info(openr=oart.open)
- self.assertEquals(oart.open_calls, [
+ self.assertEqual(oart.open_calls, [
(('/proc/net/sockstat', 'r'), {}),
(('/proc/net/sockstat6', 'r'), {})])
@@ -1023,10 +1023,10 @@ class TestReconSuccess(TestCase):
from_cache_response = {'drive_audit_errors': 7}
self.fakecache.fakeout = from_cache_response
rv = self.app.get_driveaudit_error()
- self.assertEquals(self.fakecache.fakeout_calls,
- [((['drive_audit_errors'],
- '/var/cache/swift/drive.recon'), {})])
- self.assertEquals(rv, {'drive_audit_errors': 7})
+ self.assertEqual(self.fakecache.fakeout_calls,
+ [((['drive_audit_errors'],
+ '/var/cache/swift/drive.recon'), {})])
+ self.assertEqual(rv, {'drive_audit_errors': 7})
def test_get_time(self):
def fake_time():
@@ -1035,7 +1035,7 @@ class TestReconSuccess(TestCase):
with mock.patch("time.time", fake_time):
now = fake_time()
rv = self.app.get_time()
- self.assertEquals(rv, now)
+ self.assertEqual(rv, now)
class TestReconMiddleware(unittest.TestCase):
@@ -1072,40 +1072,40 @@ class TestReconMiddleware(unittest.TestCase):
get_mem_resp = ['{"memtest": "1"}']
req = Request.blank('/recon/mem', environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_mem_resp)
+ self.assertEqual(resp, get_mem_resp)
def test_recon_get_version(self):
req = Request.blank('/recon/version',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, [utils.json.dumps({'version': swiftver})])
+ self.assertEqual(resp, [utils.json.dumps({'version': swiftver})])
def test_recon_get_load(self):
get_load_resp = ['{"loadtest": "1"}']
req = Request.blank('/recon/load', environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_load_resp)
+ self.assertEqual(resp, get_load_resp)
def test_recon_get_async(self):
get_async_resp = ['{"asynctest": "1"}']
req = Request.blank('/recon/async', environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_async_resp)
+ self.assertEqual(resp, get_async_resp)
def test_get_device_info(self):
get_device_resp = ['{"/srv/1/node": ["sdb1"]}']
req = Request.blank('/recon/devices',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_device_resp)
+ self.assertEqual(resp, get_device_resp)
def test_recon_get_replication_notype(self):
get_replication_resp = ['{"replicationtest": "1"}']
req = Request.blank('/recon/replication',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_replication_resp)
- self.assertEquals(self.frecon.fake_replication_rtype, 'object')
+ self.assertEqual(resp, get_replication_resp)
+ self.assertEqual(self.frecon.fake_replication_rtype, 'object')
self.frecon.fake_replication_rtype = None
def test_recon_get_replication_all(self):
@@ -1114,22 +1114,22 @@ class TestReconMiddleware(unittest.TestCase):
req = Request.blank('/recon/replication/account',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_replication_resp)
- self.assertEquals(self.frecon.fake_replication_rtype, 'account')
+ self.assertEqual(resp, get_replication_resp)
+ self.assertEqual(self.frecon.fake_replication_rtype, 'account')
self.frecon.fake_replication_rtype = None
# test container
req = Request.blank('/recon/replication/container',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_replication_resp)
- self.assertEquals(self.frecon.fake_replication_rtype, 'container')
+ self.assertEqual(resp, get_replication_resp)
+ self.assertEqual(self.frecon.fake_replication_rtype, 'container')
self.frecon.fake_replication_rtype = None
# test object
req = Request.blank('/recon/replication/object',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_replication_resp)
- self.assertEquals(self.frecon.fake_replication_rtype, 'object')
+ self.assertEqual(resp, get_replication_resp)
+ self.assertEqual(self.frecon.fake_replication_rtype, 'object')
self.frecon.fake_replication_rtype = None
def test_recon_get_auditor_invalid(self):
@@ -1137,34 +1137,34 @@ class TestReconMiddleware(unittest.TestCase):
req = Request.blank('/recon/auditor/invalid',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_auditor_resp)
+ self.assertEqual(resp, get_auditor_resp)
def test_recon_get_auditor_notype(self):
get_auditor_resp = ['Invalid path: /recon/auditor']
req = Request.blank('/recon/auditor',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_auditor_resp)
+ self.assertEqual(resp, get_auditor_resp)
def test_recon_get_auditor_all(self):
get_auditor_resp = ['{"auditortest": "1"}']
req = Request.blank('/recon/auditor/account',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_auditor_resp)
- self.assertEquals(self.frecon.fake_auditor_rtype, 'account')
+ self.assertEqual(resp, get_auditor_resp)
+ self.assertEqual(self.frecon.fake_auditor_rtype, 'account')
self.frecon.fake_auditor_rtype = None
req = Request.blank('/recon/auditor/container',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_auditor_resp)
- self.assertEquals(self.frecon.fake_auditor_rtype, 'container')
+ self.assertEqual(resp, get_auditor_resp)
+ self.assertEqual(self.frecon.fake_auditor_rtype, 'container')
self.frecon.fake_auditor_rtype = None
req = Request.blank('/recon/auditor/object',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_auditor_resp)
- self.assertEquals(self.frecon.fake_auditor_rtype, 'object')
+ self.assertEqual(resp, get_auditor_resp)
+ self.assertEqual(self.frecon.fake_auditor_rtype, 'object')
self.frecon.fake_auditor_rtype = None
def test_recon_get_updater_invalid(self):
@@ -1172,28 +1172,28 @@ class TestReconMiddleware(unittest.TestCase):
req = Request.blank('/recon/updater/invalid',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_updater_resp)
+ self.assertEqual(resp, get_updater_resp)
def test_recon_get_updater_notype(self):
get_updater_resp = ['Invalid path: /recon/updater']
req = Request.blank('/recon/updater',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_updater_resp)
+ self.assertEqual(resp, get_updater_resp)
def test_recon_get_updater(self):
get_updater_resp = ['{"updatertest": "1"}']
req = Request.blank('/recon/updater/container',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(self.frecon.fake_updater_rtype, 'container')
+ self.assertEqual(self.frecon.fake_updater_rtype, 'container')
self.frecon.fake_updater_rtype = None
- self.assertEquals(resp, get_updater_resp)
+ self.assertEqual(resp, get_updater_resp)
req = Request.blank('/recon/updater/object',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_updater_resp)
- self.assertEquals(self.frecon.fake_updater_rtype, 'object')
+ self.assertEqual(resp, get_updater_resp)
+ self.assertEqual(self.frecon.fake_updater_rtype, 'object')
self.frecon.fake_updater_rtype = None
def test_recon_get_expirer_invalid(self):
@@ -1201,22 +1201,22 @@ class TestReconMiddleware(unittest.TestCase):
req = Request.blank('/recon/expirer/invalid',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_updater_resp)
+ self.assertEqual(resp, get_updater_resp)
def test_recon_get_expirer_notype(self):
get_updater_resp = ['Invalid path: /recon/expirer']
req = Request.blank('/recon/expirer',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_updater_resp)
+ self.assertEqual(resp, get_updater_resp)
def test_recon_get_expirer_object(self):
get_expirer_resp = ['{"expirertest": "1"}']
req = Request.blank('/recon/expirer/object',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_expirer_resp)
- self.assertEquals(self.frecon.fake_expirer_rtype, 'object')
+ self.assertEqual(resp, get_expirer_resp)
+ self.assertEqual(self.frecon.fake_expirer_rtype, 'object')
self.frecon.fake_updater_rtype = None
def test_recon_get_mounted(self):
@@ -1224,7 +1224,7 @@ class TestReconMiddleware(unittest.TestCase):
req = Request.blank('/recon/mounted',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_mounted_resp)
+ self.assertEqual(resp, get_mounted_resp)
def test_recon_get_unmounted(self):
get_unmounted_resp = ['{"unmountedtest": "1"}']
@@ -1232,7 +1232,7 @@ class TestReconMiddleware(unittest.TestCase):
req = Request.blank('/recon/unmounted',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_unmounted_resp)
+ self.assertEqual(resp, get_unmounted_resp)
def test_recon_no_get_unmounted(self):
get_unmounted_resp = '[]'
@@ -1240,73 +1240,73 @@ class TestReconMiddleware(unittest.TestCase):
req = Request.blank('/recon/unmounted',
environ={'REQUEST_METHOD': 'GET'})
resp = ''.join(self.app(req.environ, start_response))
- self.assertEquals(resp, get_unmounted_resp)
+ self.assertEqual(resp, get_unmounted_resp)
def test_recon_get_diskusage(self):
get_diskusage_resp = ['{"diskusagetest": "1"}']
req = Request.blank('/recon/diskusage',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_diskusage_resp)
+ self.assertEqual(resp, get_diskusage_resp)
def test_recon_get_ringmd5(self):
get_ringmd5_resp = ['{"ringmd5test": "1"}']
req = Request.blank('/recon/ringmd5',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_ringmd5_resp)
+ self.assertEqual(resp, get_ringmd5_resp)
def test_recon_get_swiftconfmd5(self):
get_swiftconfmd5_resp = ['{"/etc/swift/swift.conf": "abcdef"}']
req = Request.blank('/recon/swiftconfmd5',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_swiftconfmd5_resp)
+ self.assertEqual(resp, get_swiftconfmd5_resp)
def test_recon_get_quarantined(self):
get_quarantined_resp = ['{"quarantinedtest": "1"}']
req = Request.blank('/recon/quarantined',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_quarantined_resp)
+ self.assertEqual(resp, get_quarantined_resp)
def test_recon_get_sockstat(self):
get_sockstat_resp = ['{"sockstattest": "1"}']
req = Request.blank('/recon/sockstat',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_sockstat_resp)
+ self.assertEqual(resp, get_sockstat_resp)
def test_recon_invalid_path(self):
req = Request.blank('/recon/invalid',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, ['Invalid path: /recon/invalid'])
+ self.assertEqual(resp, ['Invalid path: /recon/invalid'])
def test_no_content(self):
self.app.get_load = self.frecon.nocontent
req = Request.blank('/recon/load', environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, ['Internal server error.'])
+ self.assertEqual(resp, ['Internal server error.'])
def test_recon_pass(self):
req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, 'FAKE APP')
+ self.assertEqual(resp, 'FAKE APP')
def test_recon_get_driveaudit(self):
get_driveaudit_resp = ['{"driveaudittest": "1"}']
req = Request.blank('/recon/driveaudit',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_driveaudit_resp)
+ self.assertEqual(resp, get_driveaudit_resp)
def test_recon_get_time(self):
get_time_resp = ['{"timetest": "1"}']
req = Request.blank('/recon/time',
environ={'REQUEST_METHOD': 'GET'})
resp = self.app(req.environ, start_response)
- self.assertEquals(resp, get_time_resp)
+ self.assertEqual(resp, get_time_resp)
if __name__ == '__main__':
unittest.main()
diff --git a/test/unit/common/middleware/test_slo.py b/test/unit/common/middleware/test_slo.py
index f8455a96e6..59fb16b7f6 100644
--- a/test/unit/common/middleware/test_slo.py
+++ b/test/unit/common/middleware/test_slo.py
@@ -108,8 +108,8 @@ class TestSloMiddleware(SloTestCase):
def test_handle_multipart_no_obj(self):
req = Request.blank('/')
resp_iter = self.slo(req.environ, fake_start_response)
- self.assertEquals(self.app.calls, [('GET', '/')])
- self.assertEquals(''.join(resp_iter), 'passed')
+ self.assertEqual(self.app.calls, [('GET', '/')])
+ self.assertEqual(''.join(resp_iter), 'passed')
def test_slo_header_assigned(self):
req = Request.blank(
@@ -132,15 +132,15 @@ class TestSloMiddleware(SloTestCase):
data = json.dumps(
[{'path': '/cont/object', 'etag': 'etagoftheobjecitsegment',
'size_bytes': 100}])
- self.assertEquals('/cont/object',
- slo.parse_input(data)[0]['path'])
+ self.assertEqual('/cont/object',
+ slo.parse_input(data)[0]['path'])
data = json.dumps(
[{'path': '/cont/object', 'etag': 'etagoftheobjecitsegment',
'size_bytes': 100, 'range': '0-40,30-90'}])
parsed = slo.parse_input(data)
- self.assertEquals('/cont/object', parsed[0]['path'])
- self.assertEquals([(0, 40), (30, 90)], parsed[0]['range'].ranges)
+ self.assertEqual('/cont/object', parsed[0]['path'])
+ self.assertEqual([(0, 40), (30, 90)], parsed[0]['range'].ranges)
class TestSloPutManifest(SloTestCase):
@@ -213,7 +213,7 @@ class TestSloPutManifest(SloTestCase):
self.slo.handle_multipart_put(req, fake_start_response)
except HTTPException as e:
pass
- self.assertEquals(e.status_int, 413)
+ self.assertEqual(e.status_int, 413)
with patch.object(self.slo, 'max_manifest_segments', 0):
req = Request.blank('/v1/a/c/o', body=test_json_data)
@@ -222,7 +222,7 @@ class TestSloPutManifest(SloTestCase):
self.slo.handle_multipart_put(req, fake_start_response)
except HTTPException as e:
pass
- self.assertEquals(e.status_int, 413)
+ self.assertEqual(e.status_int, 413)
with patch.object(self.slo, 'min_segment_size', 1000):
test_json_data_2obj = json.dumps(
@@ -237,20 +237,20 @@ class TestSloPutManifest(SloTestCase):
self.slo.handle_multipart_put(req, fake_start_response)
except HTTPException as e:
pass
- self.assertEquals(e.status_int, 400)
+ self.assertEqual(e.status_int, 400)
req = Request.blank('/v1/a/c/o', headers={'X-Copy-From': 'lala'})
try:
self.slo.handle_multipart_put(req, fake_start_response)
except HTTPException as e:
pass
- self.assertEquals(e.status_int, 405)
+ self.assertEqual(e.status_int, 405)
# ignores requests to /
req = Request.blank(
'/?multipart-manifest=put',
environ={'REQUEST_METHOD': 'PUT'}, body=test_json_data)
- self.assertEquals(
+ self.assertEqual(
list(self.slo.handle_multipart_put(req, fake_start_response)),
['passed'])
@@ -310,7 +310,7 @@ class TestSloPutManifest(SloTestCase):
self.slo.handle_multipart_put(req, fake_start_response)
except HTTPException as e:
pass
- self.assertEquals(e.status_int, 400)
+ self.assertEqual(e.status_int, 400)
def test_handle_multipart_put_success_unicode(self):
test_json_data = json.dumps([{'path': u'/cont/object\u2661',
@@ -331,7 +331,7 @@ class TestSloPutManifest(SloTestCase):
environ={'REQUEST_METHOD': 'PUT'}, headers={'Accept': 'test'},
body=test_xml_data)
no_xml = self.slo(req.environ, fake_start_response)
- self.assertEquals(no_xml, ['Manifest must be valid json.'])
+ self.assertEqual(no_xml, ['Manifest must be valid json.'])
def test_handle_multipart_put_bad_data(self):
bad_data = json.dumps([{'path': '/cont/object',
@@ -374,7 +374,7 @@ class TestSloPutManifest(SloTestCase):
'/v1/AUTH_test/checktest/man_3?multipart-manifest=put',
environ={'REQUEST_METHOD': 'PUT'}, body=good_data)
status, headers, body = self.call_slo(req)
- self.assertEquals(self.app.call_count, 3)
+ self.assertEqual(self.app.call_count, 3)
# go behind SLO's back and see what actually got stored
req = Request.blank(
@@ -386,9 +386,9 @@ class TestSloPutManifest(SloTestCase):
headers = dict(headers)
manifest_data = json.loads(body)
self.assertTrue(headers['Content-Type'].endswith(';swift_bytes=3'))
- self.assertEquals(len(manifest_data), 2)
- self.assertEquals(manifest_data[0]['hash'], 'a')
- self.assertEquals(manifest_data[0]['bytes'], 1)
+ self.assertEqual(len(manifest_data), 2)
+ self.assertEqual(manifest_data[0]['hash'], 'a')
+ self.assertEqual(manifest_data[0]['bytes'], 1)
self.assertTrue(
not manifest_data[0]['last_modified'].startswith('2012'))
self.assertTrue(manifest_data[1]['last_modified'].startswith('2012'))
@@ -407,19 +407,19 @@ class TestSloPutManifest(SloTestCase):
body=bad_data)
status, headers, body = self.call_slo(req)
- self.assertEquals(self.app.call_count, 5)
+ self.assertEqual(self.app.call_count, 5)
errors = json.loads(body)['Errors']
- self.assertEquals(len(errors), 5)
- self.assertEquals(errors[0][0], '/checktest/a_1')
- self.assertEquals(errors[0][1], 'Size Mismatch')
- self.assertEquals(errors[1][0], '/checktest/badreq')
- self.assertEquals(errors[1][1], '400 Bad Request')
- self.assertEquals(errors[2][0], '/checktest/b_2')
- self.assertEquals(errors[2][1], 'Etag Mismatch')
- self.assertEquals(errors[3][0], '/checktest/slob')
- self.assertEquals(errors[3][1], 'Size Mismatch')
- self.assertEquals(errors[4][0], '/checktest/slob')
- self.assertEquals(errors[4][1], 'Etag Mismatch')
+ self.assertEqual(len(errors), 5)
+ self.assertEqual(errors[0][0], '/checktest/a_1')
+ self.assertEqual(errors[0][1], 'Size Mismatch')
+ self.assertEqual(errors[1][0], '/checktest/badreq')
+ self.assertEqual(errors[1][1], '400 Bad Request')
+ self.assertEqual(errors[2][0], '/checktest/b_2')
+ self.assertEqual(errors[2][1], 'Etag Mismatch')
+ self.assertEqual(errors[3][0], '/checktest/slob')
+ self.assertEqual(errors[3][1], 'Size Mismatch')
+ self.assertEqual(errors[4][0], '/checktest/slob')
+ self.assertEqual(errors[4][1], 'Etag Mismatch')
def test_handle_multipart_put_manifest_equal_slo(self):
test_json_data = json.dumps([{'path': '/cont/object',
@@ -469,7 +469,7 @@ class TestSloPutManifest(SloTestCase):
'/v1/AUTH_test/checktest/man_3?multipart-manifest=put',
environ={'REQUEST_METHOD': 'PUT'}, body=good_data)
status, headers, body = self.call_slo(req)
- self.assertEquals(self.app.call_count, 3)
+ self.assertEqual(self.app.call_count, 3)
# Check that we still populated the manifest properly from our HEADs
req = Request.blank(
@@ -479,8 +479,8 @@ class TestSloPutManifest(SloTestCase):
environ={'REQUEST_METHOD': 'GET'})
status, headers, body = self.call_app(req)
manifest_data = json.loads(body)
- self.assertEquals(1, manifest_data[0]['bytes'])
- self.assertEquals(2, manifest_data[1]['bytes'])
+ self.assertEqual(1, manifest_data[0]['bytes'])
+ self.assertEqual(2, manifest_data[1]['bytes'])
def test_handle_multipart_put_skip_size_check_still_uses_min_size(self):
with patch.object(self.slo, 'min_segment_size', 50):
@@ -493,7 +493,7 @@ class TestSloPutManifest(SloTestCase):
req = Request.blank('/v1/AUTH_test/c/o', body=test_json_data)
with self.assertRaises(HTTPException) as cm:
self.slo.handle_multipart_put(req, fake_start_response)
- self.assertEquals(cm.exception.status_int, 400)
+ self.assertEqual(cm.exception.status_int, 400)
def test_handle_multipart_put_skip_etag_check(self):
good_data = json.dumps(
@@ -503,7 +503,7 @@ class TestSloPutManifest(SloTestCase):
'/v1/AUTH_test/checktest/man_3?multipart-manifest=put',
environ={'REQUEST_METHOD': 'PUT'}, body=good_data)
status, headers, body = self.call_slo(req)
- self.assertEquals(self.app.call_count, 3)
+ self.assertEqual(self.app.call_count, 3)
# Check that we still populated the manifest properly from our HEADs
req = Request.blank(
@@ -513,8 +513,8 @@ class TestSloPutManifest(SloTestCase):
environ={'REQUEST_METHOD': 'GET'})
status, headers, body = self.call_app(req)
manifest_data = json.loads(body)
- self.assertEquals('a', manifest_data[0]['hash'])
- self.assertEquals('b', manifest_data[1]['hash'])
+ self.assertEqual('a', manifest_data[0]['hash'])
+ self.assertEqual('b', manifest_data[1]['hash'])
def test_handle_unsatisfiable_ranges(self):
bad_data = json.dumps(
@@ -559,18 +559,18 @@ class TestSloPutManifest(SloTestCase):
environ={'REQUEST_METHOD': 'GET'})
status, headers, body = self.call_app(req)
manifest_data = json.loads(body)
- self.assertEquals('a', manifest_data[0]['hash'])
+ self.assertEqual('a', manifest_data[0]['hash'])
self.assertNotIn('range', manifest_data[0])
self.assertNotIn('segment_bytes', manifest_data[0])
- self.assertEquals('b', manifest_data[1]['hash'])
- self.assertEquals('1-1', manifest_data[1]['range'])
+ self.assertEqual('b', manifest_data[1]['hash'])
+ self.assertEqual('1-1', manifest_data[1]['range'])
- self.assertEquals('b', manifest_data[2]['hash'])
- self.assertEquals('0-0', manifest_data[2]['range'])
+ self.assertEqual('b', manifest_data[2]['hash'])
+ self.assertEqual('0-0', manifest_data[2]['range'])
- self.assertEquals('etagoftheobjectsegment', manifest_data[3]['hash'])
- self.assertEquals('10-40', manifest_data[3]['range'])
+ self.assertEqual('etagoftheobjectsegment', manifest_data[3]['hash'])
+ self.assertEqual('10-40', manifest_data[3]['range'])
def test_handle_multiple_ranges_error(self):
good_data = json.dumps(
@@ -585,7 +585,7 @@ class TestSloPutManifest(SloTestCase):
environ={'REQUEST_METHOD': 'PUT'}, body=good_data)
status, headers, body = self.call_slo(req)
self.assertEqual(status, '400 Bad Request')
- self.assertEquals(self.app.call_count, 3)
+ self.assertEqual(self.app.call_count, 3)
self.assertEqual(body, '\n'.join([
'Errors:',
'/checktest/b_2, Multiple Ranges',
@@ -707,7 +707,7 @@ class TestSloDeleteManifest(SloTestCase):
'/v1/AUTH_test/deltest/man',
environ={'REQUEST_METHOD': 'DELETE'})
self.slo(req.environ, fake_start_response)
- self.assertEquals(self.app.call_count, 1)
+ self.assertEqual(self.app.call_count, 1)
def test_handle_multipart_delete_bad_utf8(self):
req = Request.blank(
@@ -715,10 +715,10 @@ class TestSloDeleteManifest(SloTestCase):
environ={'REQUEST_METHOD': 'DELETE',
'HTTP_ACCEPT': 'application/json'})
status, headers, body = self.call_slo(req)
- self.assertEquals(status, '200 OK')
+ self.assertEqual(status, '200 OK')
resp_data = json.loads(body)
- self.assertEquals(resp_data['Response Status'],
- '412 Precondition Failed')
+ self.assertEqual(resp_data['Response Status'],
+ '412 Precondition Failed')
def test_handle_multipart_delete_whole_404(self):
req = Request.blank(
@@ -727,15 +727,15 @@ class TestSloDeleteManifest(SloTestCase):
'HTTP_ACCEPT': 'application/json'})
status, headers, body = self.call_slo(req)
resp_data = json.loads(body)
- self.assertEquals(
+ self.assertEqual(
self.app.calls,
[('GET',
'/v1/AUTH_test/deltest/man_404?multipart-manifest=get')])
- self.assertEquals(resp_data['Response Status'], '200 OK')
- self.assertEquals(resp_data['Response Body'], '')
- self.assertEquals(resp_data['Number Deleted'], 0)
- self.assertEquals(resp_data['Number Not Found'], 1)
- self.assertEquals(resp_data['Errors'], [])
+ self.assertEqual(resp_data['Response Status'], '200 OK')
+ self.assertEqual(resp_data['Response Body'], '')
+ self.assertEqual(resp_data['Number Deleted'], 0)
+ self.assertEqual(resp_data['Number Not Found'], 1)
+ self.assertEqual(resp_data['Errors'], [])
def test_handle_multipart_delete_segment_404(self):
req = Request.blank(
@@ -744,7 +744,7 @@ class TestSloDeleteManifest(SloTestCase):
'HTTP_ACCEPT': 'application/json'})
status, headers, body = self.call_slo(req)
resp_data = json.loads(body)
- self.assertEquals(
+ self.assertEqual(
self.app.calls,
[('GET',
'/v1/AUTH_test/deltest/man?multipart-manifest=get'),
@@ -754,16 +754,16 @@ class TestSloDeleteManifest(SloTestCase):
'/v1/AUTH_test/deltest/b_2?multipart-manifest=delete'),
('DELETE',
'/v1/AUTH_test/deltest/man?multipart-manifest=delete')])
- self.assertEquals(resp_data['Response Status'], '200 OK')
- self.assertEquals(resp_data['Number Deleted'], 2)
- self.assertEquals(resp_data['Number Not Found'], 1)
+ self.assertEqual(resp_data['Response Status'], '200 OK')
+ self.assertEqual(resp_data['Number Deleted'], 2)
+ self.assertEqual(resp_data['Number Not Found'], 1)
def test_handle_multipart_delete_whole(self):
req = Request.blank(
'/v1/AUTH_test/deltest/man-all-there?multipart-manifest=delete',
environ={'REQUEST_METHOD': 'DELETE'})
self.call_slo(req)
- self.assertEquals(
+ self.assertEqual(
self.app.calls,
[('GET',
'/v1/AUTH_test/deltest/man-all-there?multipart-manifest=get'),
@@ -778,7 +778,7 @@ class TestSloDeleteManifest(SloTestCase):
'multipart-manifest=delete',
environ={'REQUEST_METHOD': 'DELETE'})
self.call_slo(req)
- self.assertEquals(
+ self.assertEqual(
set(self.app.calls),
set([('GET', '/v1/AUTH_test/deltest/' +
'manifest-with-submanifest?multipart-manifest=get'),
@@ -807,11 +807,11 @@ class TestSloDeleteManifest(SloTestCase):
'HTTP_ACCEPT': 'application/json'})
with patch.object(slo, 'MAX_BUFFERED_SLO_SEGMENTS', 1):
status, headers, body = self.call_slo(req)
- self.assertEquals(status, '200 OK')
+ self.assertEqual(status, '200 OK')
resp_data = json.loads(body)
- self.assertEquals(resp_data['Response Status'], '400 Bad Request')
- self.assertEquals(resp_data['Response Body'],
- 'Too many buffered slo segments to delete.')
+ self.assertEqual(resp_data['Response Status'], '400 Bad Request')
+ self.assertEqual(resp_data['Response Body'],
+ 'Too many buffered slo segments to delete.')
def test_handle_multipart_delete_nested_404(self):
req = Request.blank(
@@ -821,7 +821,7 @@ class TestSloDeleteManifest(SloTestCase):
'HTTP_ACCEPT': 'application/json'})
status, headers, body = self.call_slo(req)
resp_data = json.loads(body)
- self.assertEquals(
+ self.assertEqual(
self.app.calls,
[('GET', '/v1/AUTH_test/deltest/' +
'manifest-missing-submanifest?multipart-manifest=get'),
@@ -831,11 +831,11 @@ class TestSloDeleteManifest(SloTestCase):
('DELETE', '/v1/AUTH_test/deltest/d_3?multipart-manifest=delete'),
('DELETE', '/v1/AUTH_test/deltest/' +
'manifest-missing-submanifest?multipart-manifest=delete')])
- self.assertEquals(resp_data['Response Status'], '200 OK')
- self.assertEquals(resp_data['Response Body'], '')
- self.assertEquals(resp_data['Number Deleted'], 3)
- self.assertEquals(resp_data['Number Not Found'], 1)
- self.assertEquals(resp_data['Errors'], [])
+ self.assertEqual(resp_data['Response Status'], '200 OK')
+ self.assertEqual(resp_data['Response Body'], '')
+ self.assertEqual(resp_data['Number Deleted'], 3)
+ self.assertEqual(resp_data['Number Not Found'], 1)
+ self.assertEqual(resp_data['Errors'], [])
def test_handle_multipart_delete_nested_401(self):
self.app.register(
@@ -848,11 +848,11 @@ class TestSloDeleteManifest(SloTestCase):
environ={'REQUEST_METHOD': 'DELETE',
'HTTP_ACCEPT': 'application/json'})
status, headers, body = self.call_slo(req)
- self.assertEquals(status, '200 OK')
+ self.assertEqual(status, '200 OK')
resp_data = json.loads(body)
- self.assertEquals(resp_data['Response Status'], '400 Bad Request')
- self.assertEquals(resp_data['Errors'],
- [['/deltest/submanifest', '401 Unauthorized']])
+ self.assertEqual(resp_data['Response Status'], '400 Bad Request')
+ self.assertEqual(resp_data['Errors'],
+ [['/deltest/submanifest', '401 Unauthorized']])
def test_handle_multipart_delete_nested_500(self):
self.app.register(
@@ -865,12 +865,12 @@ class TestSloDeleteManifest(SloTestCase):
environ={'REQUEST_METHOD': 'DELETE',
'HTTP_ACCEPT': 'application/json'})
status, headers, body = self.call_slo(req)
- self.assertEquals(status, '200 OK')
+ self.assertEqual(status, '200 OK')
resp_data = json.loads(body)
- self.assertEquals(resp_data['Response Status'], '400 Bad Request')
- self.assertEquals(resp_data['Errors'],
- [['/deltest/submanifest',
- 'Unable to load SLO manifest or segment.']])
+ self.assertEqual(resp_data['Response Status'], '400 Bad Request')
+ self.assertEqual(resp_data['Errors'],
+ [['/deltest/submanifest',
+ 'Unable to load SLO manifest or segment.']])
def test_handle_multipart_delete_not_a_manifest(self):
req = Request.blank(
@@ -879,15 +879,15 @@ class TestSloDeleteManifest(SloTestCase):
'HTTP_ACCEPT': 'application/json'})
status, headers, body = self.call_slo(req)
resp_data = json.loads(body)
- self.assertEquals(
+ self.assertEqual(
self.app.calls,
[('GET', '/v1/AUTH_test/deltest/a_1?multipart-manifest=get')])
- self.assertEquals(resp_data['Response Status'], '400 Bad Request')
- self.assertEquals(resp_data['Response Body'], '')
- self.assertEquals(resp_data['Number Deleted'], 0)
- self.assertEquals(resp_data['Number Not Found'], 0)
- self.assertEquals(resp_data['Errors'],
- [['/deltest/a_1', 'Not an SLO manifest']])
+ self.assertEqual(resp_data['Response Status'], '400 Bad Request')
+ self.assertEqual(resp_data['Response Body'], '')
+ self.assertEqual(resp_data['Number Deleted'], 0)
+ self.assertEqual(resp_data['Number Not Found'], 0)
+ self.assertEqual(resp_data['Errors'],
+ [['/deltest/a_1', 'Not an SLO manifest']])
def test_handle_multipart_delete_bad_json(self):
req = Request.blank(
@@ -896,16 +896,16 @@ class TestSloDeleteManifest(SloTestCase):
'HTTP_ACCEPT': 'application/json'})
status, headers, body = self.call_slo(req)
resp_data = json.loads(body)
- self.assertEquals(self.app.calls,
- [('GET', '/v1/AUTH_test/deltest/' +
- 'manifest-badjson?multipart-manifest=get')])
- self.assertEquals(resp_data['Response Status'], '400 Bad Request')
- self.assertEquals(resp_data['Response Body'], '')
- self.assertEquals(resp_data['Number Deleted'], 0)
- self.assertEquals(resp_data['Number Not Found'], 0)
- self.assertEquals(resp_data['Errors'],
- [['/deltest/manifest-badjson',
- 'Unable to load SLO manifest']])
+ self.assertEqual(self.app.calls,
+ [('GET', '/v1/AUTH_test/deltest/' +
+ 'manifest-badjson?multipart-manifest=get')])
+ self.assertEqual(resp_data['Response Status'], '400 Bad Request')
+ self.assertEqual(resp_data['Response Body'], '')
+ self.assertEqual(resp_data['Number Deleted'], 0)
+ self.assertEqual(resp_data['Number Not Found'], 0)
+ self.assertEqual(resp_data['Errors'],
+ [['/deltest/manifest-badjson',
+ 'Unable to load SLO manifest']])
def test_handle_multipart_delete_401(self):
req = Request.blank(
@@ -915,7 +915,7 @@ class TestSloDeleteManifest(SloTestCase):
'HTTP_ACCEPT': 'application/json'})
status, headers, body = self.call_slo(req)
resp_data = json.loads(body)
- self.assertEquals(
+ self.assertEqual(
self.app.calls,
[('GET', '/v1/AUTH_test/deltest/' +
'manifest-with-unauth-segment?multipart-manifest=get'),
@@ -924,12 +924,12 @@ class TestSloDeleteManifest(SloTestCase):
'q_17?multipart-manifest=delete'),
('DELETE', '/v1/AUTH_test/deltest/' +
'manifest-with-unauth-segment?multipart-manifest=delete')])
- self.assertEquals(resp_data['Response Status'], '400 Bad Request')
- self.assertEquals(resp_data['Response Body'], '')
- self.assertEquals(resp_data['Number Deleted'], 2)
- self.assertEquals(resp_data['Number Not Found'], 0)
- self.assertEquals(resp_data['Errors'],
- [['/deltest-unauth/q_17', '401 Unauthorized']])
+ self.assertEqual(resp_data['Response Status'], '400 Bad Request')
+ self.assertEqual(resp_data['Response Body'], '')
+ self.assertEqual(resp_data['Number Deleted'], 2)
+ self.assertEqual(resp_data['Number Not Found'], 0)
+ self.assertEqual(resp_data['Errors'],
+ [['/deltest-unauth/q_17', '401 Unauthorized']])
class TestSloHeadManifest(SloTestCase):
diff --git a/test/unit/common/middleware/test_staticweb.py b/test/unit/common/middleware/test_staticweb.py
index c0836a341b..c9ce97cf5e 100644
--- a/test/unit/common/middleware/test_staticweb.py
+++ b/test/unit/common/middleware/test_staticweb.py
@@ -393,117 +393,117 @@ class TestStaticWeb(unittest.TestCase):
def test_app_set(self):
app = FakeApp()
sw = staticweb.filter_factory({})(app)
- self.assertEquals(sw.app, app)
+ self.assertEqual(sw.app, app)
def test_conf_set(self):
conf = {'blah': 1}
sw = staticweb.filter_factory(conf)(FakeApp())
- self.assertEquals(sw.conf, conf)
+ self.assertEqual(sw.conf, conf)
def test_root(self):
resp = Request.blank('/').get_response(self.test_staticweb)
- self.assertEquals(resp.status_int, 404)
+ self.assertEqual(resp.status_int, 404)
def test_version(self):
resp = Request.blank('/v1').get_response(self.test_staticweb)
- self.assertEquals(resp.status_int, 412)
+ self.assertEqual(resp.status_int, 412)
def test_account(self):
resp = Request.blank('/v1/a').get_response(self.test_staticweb)
- self.assertEquals(resp.status_int, 401)
+ self.assertEqual(resp.status_int, 401)
def test_container1(self):
resp = Request.blank('/v1/a/c1').get_response(self.test_staticweb)
- self.assertEquals(resp.status_int, 401)
+ self.assertEqual(resp.status_int, 401)
def test_container1_web_mode_explicitly_off(self):
resp = Request.blank('/v1/a/c1',
headers={'x-web-mode': 'false'}).get_response(
self.test_staticweb)
- self.assertEquals(resp.status_int, 401)
+ self.assertEqual(resp.status_int, 401)
def test_container1_web_mode_explicitly_on(self):
resp = Request.blank('/v1/a/c1',
headers={'x-web-mode': 'true'}).get_response(
self.test_staticweb)
- self.assertEquals(resp.status_int, 404)
+ self.assertEqual(resp.status_int, 404)
def test_container2(self):
resp = Request.blank('/v1/a/c2').get_response(self.test_staticweb)
- self.assertEquals(resp.status_int, 200)
- self.assertEquals(resp.content_type, 'text/plain')
- self.assertEquals(len(resp.body.split('\n')),
- int(resp.headers['x-container-object-count']))
+ self.assertEqual(resp.status_int, 200)
+ self.assertEqual(resp.content_type, 'text/plain')
+ self.assertEqual(len(resp.body.split('\n')),
+ int(resp.headers['x-container-object-count']))
def test_container2_web_mode_explicitly_off(self):
resp = Request.blank(
'/v1/a/c2',
headers={'x-web-mode': 'false'}).get_response(self.test_staticweb)
- self.assertEquals(resp.status_int, 200)
- self.assertEquals(resp.content_type, 'text/plain')
- self.assertEquals(len(resp.body.split('\n')),
- int(resp.headers['x-container-object-count']))
+ self.assertEqual(resp.status_int, 200)
+ self.assertEqual(resp.content_type, 'text/plain')
+ self.assertEqual(len(resp.body.split('\n')),
+ int(resp.headers['x-container-object-count']))
def test_container2_web_mode_explicitly_on(self):
resp = Request.blank(
'/v1/a/c2',
headers={'x-web-mode': 'true'}).get_response(self.test_staticweb)
- self.assertEquals(resp.status_int, 404)
+ self.assertEqual(resp.status_int, 404)
def test_container2onetxt(self):
resp = Request.blank(
'/v1/a/c2/one.txt').get_response(self.test_staticweb)
- self.assertEquals(resp.status_int, 404)
+ self.assertEqual(resp.status_int, 404)
def test_container2json(self):
resp = Request.blank(
'/v1/a/c2?format=json').get_response(self.test_staticweb)
- self.assertEquals(resp.status_int, 200)
- self.assertEquals(resp.content_type, 'application/json')
- self.assertEquals(len(json.loads(resp.body)),
- int(resp.headers['x-container-object-count']))
+ self.assertEqual(resp.status_int, 200)
+ self.assertEqual(resp.content_type, 'application/json')
+ self.assertEqual(len(json.loads(resp.body)),
+ int(resp.headers['x-container-object-count']))
def test_container2json_web_mode_explicitly_off(self):
resp = Request.blank(
'/v1/a/c2?format=json',
headers={'x-web-mode': 'false'}).get_response(self.test_staticweb)
- self.assertEquals(resp.status_int, 200)
- self.assertEquals(resp.content_type, 'application/json')
- self.assertEquals(len(json.loads(resp.body)),
- int(resp.headers['x-container-object-count']))
+ self.assertEqual(resp.status_int, 200)
+ self.assertEqual(resp.content_type, 'application/json')
+ self.assertEqual(len(json.loads(resp.body)),
+ int(resp.headers['x-container-object-count']))
def test_container2json_web_mode_explicitly_on(self):
resp = Request.blank(
'/v1/a/c2?format=json',
headers={'x-web-mode': 'true'}).get_response(self.test_staticweb)
- self.assertEquals(resp.status_int, 404)
+ self.assertEqual(resp.status_int, 404)
def test_container3(self):
resp = Request.blank('/v1/a/c3').get_response(self.test_staticweb)
- self.assertEquals(resp.status_int, 301)
- self.assertEquals(resp.headers['location'],
- 'http://localhost/v1/a/c3/')
+ self.assertEqual(resp.status_int, 301)
+ self.assertEqual(resp.headers['location'],
+ 'http://localhost/v1/a/c3/')
def test_container3indexhtml(self):
resp = Request.blank('/v1/a/c3/').get_response(self.test_staticweb)
- self.assertEquals(resp.status_int, 200)
+ self.assertEqual(resp.status_int, 200)
self.assertTrue('Test main index.html file.' in resp.body)
def test_container3subsubdir(self):
resp = Request.blank(
'/v1/a/c3/subdir3/subsubdir').get_response(self.test_staticweb)
- self.assertEquals(resp.status_int, 301)
+ self.assertEqual(resp.status_int, 301)
def test_container3subsubdircontents(self):
resp = Request.blank(
'/v1/a/c3/subdir3/subsubdir/').get_response(self.test_staticweb)
- self.assertEquals(resp.status_int, 200)
- self.assertEquals(resp.body, 'index file')
+ self.assertEqual(resp.status_int, 200)
+ self.assertEqual(resp.body, 'index file')
def test_container3subdir(self):
resp = Request.blank(
'/v1/a/c3/subdir/').get_response(self.test_staticweb)
- self.assertEquals(resp.status_int, 200)
+ 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.assertTrue('c11 subdir index' in resp.body)
def test_container11subdirmarkermatchdirtype(self):
resp = Request.blank('/v1/a/c11a/subdir/').get_response(
self.test_staticweb)
- self.assertEquals(resp.status_int, 404)
+ self.assertEqual(resp.status_int, 404)
self.assertTrue('Index File Not Found' in resp.body)
def test_container11subdirmarkeraltdirtype(self):
resp = Request.blank('/v1/a/c11a/subdir2/').get_response(
self.test_staticweb)
- self.assertEquals(resp.status_int, 200)
+ self.assertEqual(resp.status_int, 200)
def test_container11subdirmarkerinvaliddirtype(self):
resp = Request.blank('/v1/a/c11a/subdir3/').get_response(
self.test_staticweb)
- self.assertEquals(resp.status_int, 200)
+ self.assertEqual(resp.status_int, 200)
def test_container12unredirectedrequest(self):
resp = Request.blank('/v1/a/c12/').get_response(
self.test_staticweb)
- self.assertEquals(resp.status_int, 200)
+ self.assertEqual(resp.status_int, 200)
self.assertTrue('index file' in resp.body)
def test_container_404_has_css(self):
resp = Request.blank('/v1/a/c13/').get_response(
self.test_staticweb)
- self.assertEquals(resp.status_int, 404)
+ self.assertEqual(resp.status_int, 404)
self.assertTrue('listing.css' in resp.body)
def test_container_404_has_no_css(self):
resp = Request.blank('/v1/a/c7/').get_response(
self.test_staticweb)
- self.assertEquals(resp.status_int, 404)
+ self.assertEqual(resp.status_int, 404)
self.assertTrue('listing.css' not in resp.body)
self.assertTrue('