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
This commit is contained in:
zheng yin 2016-08-17 19:27:13 +08:00
parent 216d68eaa8
commit 8d6bf368f7

View File

@ -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)