pep8 fix: assertEquals -> assertEqual
assertEquals is deprecated in py3 in dir : test/unit/account/* Change-Id: I70415197df1b0d58d4d6e219733c13a9c9cdfff7
This commit is contained in:
parent
5b24b22498
commit
6594bbebb5
@ -52,9 +52,9 @@ class TestAccountBroker(unittest.TestCase):
|
|||||||
pass
|
pass
|
||||||
except DatabaseConnectionError as e:
|
except DatabaseConnectionError as e:
|
||||||
self.assertTrue(hasattr(e, 'path'))
|
self.assertTrue(hasattr(e, 'path'))
|
||||||
self.assertEquals(e.path, ':memory:')
|
self.assertEqual(e.path, ':memory:')
|
||||||
self.assertTrue(hasattr(e, 'msg'))
|
self.assertTrue(hasattr(e, 'msg'))
|
||||||
self.assertEquals(e.msg, "DB doesn't exist")
|
self.assertEqual(e.msg, "DB doesn't exist")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.fail("Unexpected exception raised: %r" % e)
|
self.fail("Unexpected exception raised: %r" % e)
|
||||||
else:
|
else:
|
||||||
@ -584,8 +584,8 @@ class TestAccountBroker(unittest.TestCase):
|
|||||||
broker2.merge_items(json.loads(json.dumps(broker1.get_items_since(
|
broker2.merge_items(json.loads(json.dumps(broker1.get_items_since(
|
||||||
broker2.get_sync(id1), 1000))), id1)
|
broker2.get_sync(id1), 1000))), id1)
|
||||||
items = broker2.get_items_since(-1, 1000)
|
items = broker2.get_items_since(-1, 1000)
|
||||||
self.assertEquals(['b', snowman],
|
self.assertEqual(['b', snowman],
|
||||||
sorted([rec['name'] for rec in items]))
|
sorted([rec['name'] for rec in items]))
|
||||||
items_by_name = dict((rec['name'], rec) for rec in items)
|
items_by_name = dict((rec['name'], rec) for rec in items)
|
||||||
|
|
||||||
self.assertEqual(items_by_name[snowman]['object_count'], 2)
|
self.assertEqual(items_by_name[snowman]['object_count'], 2)
|
||||||
|
@ -387,7 +387,7 @@ class TestReaper(unittest.TestCase):
|
|||||||
'1429117638.86767')
|
'1429117638.86767')
|
||||||
|
|
||||||
# verify calls to direct_delete_container
|
# verify calls to direct_delete_container
|
||||||
self.assertEquals(mocks['direct_delete_container'].call_count, 3)
|
self.assertEqual(mocks['direct_delete_container'].call_count, 3)
|
||||||
for i, call_args in enumerate(
|
for i, call_args in enumerate(
|
||||||
mocks['direct_delete_container'].call_args_list):
|
mocks['direct_delete_container'].call_args_list):
|
||||||
anode = acc_nodes[i % len(acc_nodes)]
|
anode = acc_nodes[i % len(acc_nodes)]
|
||||||
|
@ -63,13 +63,13 @@ class TestAccountController(unittest.TestCase):
|
|||||||
req = Request.blank('/sda1/p/a/c/o', {'REQUEST_METHOD': 'OPTIONS'})
|
req = Request.blank('/sda1/p/a/c/o', {'REQUEST_METHOD': 'OPTIONS'})
|
||||||
req.content_length = 0
|
req.content_length = 0
|
||||||
resp = server_handler.OPTIONS(req)
|
resp = server_handler.OPTIONS(req)
|
||||||
self.assertEquals(200, resp.status_int)
|
self.assertEqual(200, resp.status_int)
|
||||||
for verb in 'OPTIONS GET POST PUT DELETE HEAD REPLICATE'.split():
|
for verb in 'OPTIONS GET POST PUT DELETE HEAD REPLICATE'.split():
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
verb in resp.headers['Allow'].split(', '))
|
verb in resp.headers['Allow'].split(', '))
|
||||||
self.assertEquals(len(resp.headers['Allow'].split(', ')), 7)
|
self.assertEqual(len(resp.headers['Allow'].split(', ')), 7)
|
||||||
self.assertEquals(resp.headers['Server'],
|
self.assertEqual(resp.headers['Server'],
|
||||||
(server_handler.server_type + '/' + swift_version))
|
(server_handler.server_type + '/' + swift_version))
|
||||||
|
|
||||||
def test_DELETE_not_found(self):
|
def test_DELETE_not_found(self):
|
||||||
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'DELETE',
|
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'DELETE',
|
||||||
@ -599,11 +599,11 @@ class TestAccountController(unittest.TestCase):
|
|||||||
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'PUT',
|
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'PUT',
|
||||||
'HTTP_X_TIMESTAMP': '0'})
|
'HTTP_X_TIMESTAMP': '0'})
|
||||||
resp = req.get_response(self.controller)
|
resp = req.get_response(self.controller)
|
||||||
self.assertEquals(resp.status_int, 201)
|
self.assertEqual(resp.status_int, 201)
|
||||||
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'DELETE',
|
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'DELETE',
|
||||||
'HTTP_X_TIMESTAMP': '1'})
|
'HTTP_X_TIMESTAMP': '1'})
|
||||||
resp = req.get_response(self.controller)
|
resp = req.get_response(self.controller)
|
||||||
self.assertEquals(resp.status_int, 204)
|
self.assertEqual(resp.status_int, 204)
|
||||||
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'POST',
|
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'POST',
|
||||||
'HTTP_X_TIMESTAMP': '2'})
|
'HTTP_X_TIMESTAMP': '2'})
|
||||||
resp = req.get_response(self.controller)
|
resp = req.get_response(self.controller)
|
||||||
@ -1095,7 +1095,7 @@ class TestAccountController(unittest.TestCase):
|
|||||||
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'PUT',
|
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'PUT',
|
||||||
'HTTP_X_TIMESTAMP': '0'})
|
'HTTP_X_TIMESTAMP': '0'})
|
||||||
resp = req.get_response(self.controller)
|
resp = req.get_response(self.controller)
|
||||||
self.assertEquals(resp.status_int, 201)
|
self.assertEqual(resp.status_int, 201)
|
||||||
req = Request.blank('/sda1/p/a/c1', environ={'REQUEST_METHOD': 'PUT'},
|
req = Request.blank('/sda1/p/a/c1', environ={'REQUEST_METHOD': 'PUT'},
|
||||||
headers={'X-Put-Timestamp': '1',
|
headers={'X-Put-Timestamp': '1',
|
||||||
'X-Delete-Timestamp': '0',
|
'X-Delete-Timestamp': '0',
|
||||||
@ -1103,7 +1103,7 @@ class TestAccountController(unittest.TestCase):
|
|||||||
'X-Bytes-Used': '0',
|
'X-Bytes-Used': '0',
|
||||||
'X-Timestamp': normalize_timestamp(0)})
|
'X-Timestamp': normalize_timestamp(0)})
|
||||||
resp = req.get_response(self.controller)
|
resp = req.get_response(self.controller)
|
||||||
self.assertEquals(resp.status_int, 201)
|
self.assertEqual(resp.status_int, 201)
|
||||||
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'GET'})
|
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'GET'})
|
||||||
req.accept = 'application/*'
|
req.accept = 'application/*'
|
||||||
resp = req.get_response(self.controller)
|
resp = req.get_response(self.controller)
|
||||||
@ -1687,8 +1687,8 @@ class TestAccountController(unittest.TestCase):
|
|||||||
'wsgi.multiprocess': False,
|
'wsgi.multiprocess': False,
|
||||||
'wsgi.run_once': False}
|
'wsgi.run_once': False}
|
||||||
self.controller(env, start_response)
|
self.controller(env, start_response)
|
||||||
self.assertEquals(errbuf.getvalue(), '')
|
self.assertEqual(errbuf.getvalue(), '')
|
||||||
self.assertEquals(outbuf.getvalue()[:4], '405 ')
|
self.assertEqual(outbuf.getvalue()[:4], '405 ')
|
||||||
|
|
||||||
def test_GET_log_requests_true(self):
|
def test_GET_log_requests_true(self):
|
||||||
self.controller.logger = FakeLogger()
|
self.controller.logger = FakeLogger()
|
||||||
@ -1748,15 +1748,15 @@ class TestAccountController(unittest.TestCase):
|
|||||||
req = Request.blank('/sda1/p/a', method=method)
|
req = Request.blank('/sda1/p/a', method=method)
|
||||||
resp = req.get_response(self.controller)
|
resp = req.get_response(self.controller)
|
||||||
self.assertEqual(resp.status_int // 100, 2)
|
self.assertEqual(resp.status_int // 100, 2)
|
||||||
self.assertEquals(resp.headers['X-Account-Object-Count'], '2')
|
self.assertEqual(resp.headers['X-Account-Object-Count'], '2')
|
||||||
self.assertEquals(resp.headers['X-Account-Bytes-Used'], '4')
|
self.assertEqual(resp.headers['X-Account-Bytes-Used'], '4')
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
resp.headers['X-Account-Storage-Policy-%s-Object-Count' %
|
resp.headers['X-Account-Storage-Policy-%s-Object-Count' %
|
||||||
POLICIES[0].name], '2')
|
POLICIES[0].name], '2')
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
resp.headers['X-Account-Storage-Policy-%s-Bytes-Used' %
|
resp.headers['X-Account-Storage-Policy-%s-Bytes-Used' %
|
||||||
POLICIES[0].name], '4')
|
POLICIES[0].name], '4')
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
resp.headers['X-Account-Storage-Policy-%s-Container-Count' %
|
resp.headers['X-Account-Storage-Policy-%s-Container-Count' %
|
||||||
POLICIES[0].name], '1')
|
POLICIES[0].name], '1')
|
||||||
|
|
||||||
@ -1786,15 +1786,15 @@ class TestAccountController(unittest.TestCase):
|
|||||||
req = Request.blank('/sda1/p/a', method=method)
|
req = Request.blank('/sda1/p/a', method=method)
|
||||||
resp = req.get_response(self.controller)
|
resp = req.get_response(self.controller)
|
||||||
self.assertEqual(resp.status_int // 100, 2)
|
self.assertEqual(resp.status_int // 100, 2)
|
||||||
self.assertEquals(resp.headers['X-Account-Object-Count'], '2')
|
self.assertEqual(resp.headers['X-Account-Object-Count'], '2')
|
||||||
self.assertEquals(resp.headers['X-Account-Bytes-Used'], '4')
|
self.assertEqual(resp.headers['X-Account-Bytes-Used'], '4')
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
resp.headers['X-Account-Storage-Policy-%s-Object-Count' %
|
resp.headers['X-Account-Storage-Policy-%s-Object-Count' %
|
||||||
policy.name], '2')
|
policy.name], '2')
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
resp.headers['X-Account-Storage-Policy-%s-Bytes-Used' %
|
resp.headers['X-Account-Storage-Policy-%s-Bytes-Used' %
|
||||||
policy.name], '4')
|
policy.name], '4')
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
resp.headers['X-Account-Storage-Policy-%s-Container-Count' %
|
resp.headers['X-Account-Storage-Policy-%s-Container-Count' %
|
||||||
policy.name], '1')
|
policy.name], '1')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user