"""
-import exceptions
import os
import mock
def test_put_container_exception(self):
self.mock_object(os.path, 'exists', mock.Mock(return_value=False))
self.mock_object(os, 'makedirs', mock.Mock(
- side_effect=exceptions.OSError))
+ side_effect=OSError))
self.mock_object(os, 'chmod')
path = os.path.join(self.driver.backup_path, FAKE_CONTAINER)
- self.assertRaises(exceptions.OSError, self.driver.put_container,
+ self.assertRaises(OSError, self.driver.put_container,
FAKE_CONTAINER)
os.path.exists.assert_called_once_with(path)
os.makedirs.called_once_with(path)
def test_delete_nonexistent_object(self):
self.mock_object(os, 'remove', mock.Mock(
- side_effect=exceptions.OSError))
+ side_effect=OSError))
- self.assertRaises(exceptions.OSError,
+ self.assertRaises(OSError,
self.driver.delete_object, FAKE_CONTAINER,
FAKE_OBJECT_NAME)
root['e1'] = 'v1'
root['e2'] = 1
root['e3'] = 2.0
- root['e4'] = 8l
+ root['e4'] = 8
self.assertEqual(4, len(root.get_children()))
self.assertEqual('v1', root.get_child_content('e1'))
self.assertEqual('1', root.get_child_content('e2'))
invoke_generator = netapp_api.invoke_api(**params)
self.assertEqual(netapp_api.NaElement('success').to_string(),
- invoke_generator.next().to_string())
+ next(invoke_generator).to_string())
def test_create_api_request(self):
""""Tests creating api request"""
def convert_uuid_to_es_fmt(uuid_str):
"""Converts uuid to e-series compatible name format."""
uuid_base32 = encode_hex_to_base32(uuid.UUID(six.text_type(uuid_str)).hex)
- return uuid_base32.strip('=')
+ return uuid_base32.strip(b'=')
def convert_es_fmt_to_uuid(es_label):
self._sleep_factor = sleep_factor
def __call__(self, fun):
- func_name = fun.func_name
+ func_name = fun.__name__
@functools.wraps(fun)
def wrapped(*args, **kwargs):