Merge "Remove unnecessary variable"

This commit is contained in:
Jenkins 2016-09-02 06:46:46 +00:00 committed by Gerrit Code Review
commit 26bb5bdf72

View File

@ -261,14 +261,13 @@ class TestDirectClient(unittest.TestCase):
self.assertTrue('GET' in str(err)) self.assertTrue('GET' in str(err))
def test_direct_delete_account(self): def test_direct_delete_account(self):
node = {'ip': '1.2.3.4', 'port': '6200', 'device': 'sda'}
part = '0' part = '0'
account = 'a' account = 'a'
mock_path = 'swift.common.bufferedhttp.http_connect_raw' mock_path = 'swift.common.bufferedhttp.http_connect_raw'
with mock.patch(mock_path) as fake_connect: with mock.patch(mock_path) as fake_connect:
fake_connect.return_value.getresponse.return_value.status = 200 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 args, kwargs = fake_connect.call_args
method = args[2] method = args[2]
self.assertEqual('DELETE', method) self.assertEqual('DELETE', method)
@ -278,13 +277,12 @@ class TestDirectClient(unittest.TestCase):
self.assertTrue('X-Timestamp' in headers) self.assertTrue('X-Timestamp' in headers)
def test_direct_delete_account_failure(self): def test_direct_delete_account_failure(self):
node = {'ip': '1.2.3.4', 'port': '6200', 'device': 'sda'}
part = '0' part = '0'
account = 'a' account = 'a'
with mocked_http_conn(500) as conn: with mocked_http_conn(500) as conn:
try: try:
direct_client.direct_delete_account(node, part, account) direct_client.direct_delete_account(self.node, part, account)
except ClientException as err: except ClientException as err:
pass pass
self.assertEqual('DELETE', conn.method) self.assertEqual('DELETE', conn.method)