From 8d6bf368f710e1fdb1cf548ad3e40baddea3e7c7 Mon Sep 17 00:00:00 2001 From: zheng yin Date: Wed, 17 Aug 2016 19:27:13 +0800 Subject: [PATCH] Remove unnecessary variable It defines self.node information in setUp(), it is unnecessary to define node in test_direct_delete_account. Because although self.node includes replication_ip and replication_port, direct_delete_account doesn't use both and uses ip,port and device. Therefore, I think self.node can instead of node. Change-Id: I6df7081280d2b540f984e4e688620931f5d4ac88 --- test/unit/common/test_direct_client.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/unit/common/test_direct_client.py b/test/unit/common/test_direct_client.py index 31909388c3..54d08588f4 100644 --- a/test/unit/common/test_direct_client.py +++ b/test/unit/common/test_direct_client.py @@ -247,14 +247,13 @@ class TestDirectClient(unittest.TestCase): self.assertTrue('GET' in str(err)) def test_direct_delete_account(self): - node = {'ip': '1.2.3.4', 'port': '6200', 'device': 'sda'} part = '0' account = 'a' mock_path = 'swift.common.bufferedhttp.http_connect_raw' with mock.patch(mock_path) as fake_connect: fake_connect.return_value.getresponse.return_value.status = 200 - direct_client.direct_delete_account(node, part, account) + direct_client.direct_delete_account(self.node, part, account) args, kwargs = fake_connect.call_args method = args[2] self.assertEqual('DELETE', method) @@ -264,13 +263,12 @@ class TestDirectClient(unittest.TestCase): self.assertTrue('X-Timestamp' in headers) def test_direct_delete_account_failure(self): - node = {'ip': '1.2.3.4', 'port': '6200', 'device': 'sda'} part = '0' account = 'a' with mocked_http_conn(500) as conn: try: - direct_client.direct_delete_account(node, part, account) + direct_client.direct_delete_account(self.node, part, account) except ClientException as err: pass self.assertEqual('DELETE', conn.method)