Merge "Minor clean up in iLO drivers unit tests"
This commit is contained in:
commit
4594d6f1f2
@ -560,21 +560,18 @@ class IloBootPrivateMethodsTestCase(db_base.DbTestCase):
|
|||||||
func_set_secure_boot_mode.assert_called_once_with(task, False)
|
func_set_secure_boot_mode.assert_called_once_with(task, False)
|
||||||
self.assertTrue(returned_state)
|
self.assertTrue(returned_state)
|
||||||
|
|
||||||
@mock.patch.object(ilo_boot.LOG, 'debug', spec_set=True, autospec=True)
|
|
||||||
@mock.patch.object(ilo_boot, 'exception', spec_set=True, autospec=True)
|
@mock.patch.object(ilo_boot, 'exception', spec_set=True, autospec=True)
|
||||||
@mock.patch.object(ilo_common, 'get_secure_boot_mode', spec_set=True,
|
@mock.patch.object(ilo_common, 'get_secure_boot_mode', spec_set=True,
|
||||||
autospec=True)
|
autospec=True)
|
||||||
def test__disable_secure_boot_exception(self,
|
def test__disable_secure_boot_exception(self,
|
||||||
func_get_secure_boot_mode,
|
func_get_secure_boot_mode,
|
||||||
exception_mock,
|
exception_mock):
|
||||||
mock_log):
|
|
||||||
with task_manager.acquire(self.context, self.node.uuid,
|
with task_manager.acquire(self.context, self.node.uuid,
|
||||||
shared=False) as task:
|
shared=False) as task:
|
||||||
exception_mock.IloOperationNotSupported = Exception
|
exception_mock.IloOperationNotSupported = Exception
|
||||||
func_get_secure_boot_mode.side_effect = Exception
|
func_get_secure_boot_mode.side_effect = Exception
|
||||||
returned_state = ilo_boot._disable_secure_boot(task)
|
returned_state = ilo_boot._disable_secure_boot(task)
|
||||||
func_get_secure_boot_mode.assert_called_once_with(task)
|
func_get_secure_boot_mode.assert_called_once_with(task)
|
||||||
self.assertTrue(mock_log.called)
|
|
||||||
self.assertFalse(returned_state)
|
self.assertFalse(returned_state)
|
||||||
|
|
||||||
@mock.patch.object(ilo_common, 'update_boot_mode', spec_set=True,
|
@mock.patch.object(ilo_common, 'update_boot_mode', spec_set=True,
|
||||||
|
@ -852,8 +852,7 @@ class IloCommonMethodsTestCase(db_base.DbTestCase):
|
|||||||
assert_called_once_with("/webserver/tmp_image_file"))
|
assert_called_once_with("/webserver/tmp_image_file"))
|
||||||
|
|
||||||
@mock.patch.object(swift, 'SwiftAPI', spec_set=True, autospec=True)
|
@mock.patch.object(swift, 'SwiftAPI', spec_set=True, autospec=True)
|
||||||
@mock.patch.object(ilo_common, 'LOG')
|
def test_copy_image_to_swift(self, swift_api_mock):
|
||||||
def test_copy_image_to_swift(self, LOG_mock, swift_api_mock):
|
|
||||||
# | GIVEN |
|
# | GIVEN |
|
||||||
self.config(swift_ilo_container='ilo_container', group='ilo')
|
self.config(swift_ilo_container='ilo_container', group='ilo')
|
||||||
self.config(swift_object_expiry_timeout=1, group='ilo')
|
self.config(swift_object_expiry_timeout=1, group='ilo')
|
||||||
@ -906,7 +905,7 @@ class IloCommonMethodsTestCase(db_base.DbTestCase):
|
|||||||
swift_obj_mock.delete_object.assert_called_once_with(
|
swift_obj_mock.delete_object.assert_called_once_with(
|
||||||
container, object_name)
|
container, object_name)
|
||||||
|
|
||||||
@mock.patch.object(ilo_common, 'LOG')
|
@mock.patch.object(ilo_common, 'LOG', spec_set=True, autospec=True)
|
||||||
@mock.patch.object(swift, 'SwiftAPI', spec_set=True, autospec=True)
|
@mock.patch.object(swift, 'SwiftAPI', spec_set=True, autospec=True)
|
||||||
def test_remove_image_from_swift_suppresses_notfound_exc(
|
def test_remove_image_from_swift_suppresses_notfound_exc(
|
||||||
self, swift_api_mock, LOG_mock):
|
self, swift_api_mock, LOG_mock):
|
||||||
@ -925,7 +924,7 @@ class IloCommonMethodsTestCase(db_base.DbTestCase):
|
|||||||
LOG_mock.warning.assert_called_once_with(
|
LOG_mock.warning.assert_called_once_with(
|
||||||
mock.ANY, {'associated_with_msg': "", 'err': raised_exc})
|
mock.ANY, {'associated_with_msg': "", 'err': raised_exc})
|
||||||
|
|
||||||
@mock.patch.object(ilo_common, 'LOG')
|
@mock.patch.object(ilo_common, 'LOG', spec_set=True, autospec=True)
|
||||||
@mock.patch.object(swift, 'SwiftAPI', spec_set=True, autospec=True)
|
@mock.patch.object(swift, 'SwiftAPI', spec_set=True, autospec=True)
|
||||||
def test_remove_image_from_swift_suppresses_operror_exc(
|
def test_remove_image_from_swift_suppresses_operror_exc(
|
||||||
self, swift_api_mock, LOG_mock):
|
self, swift_api_mock, LOG_mock):
|
||||||
|
@ -306,11 +306,10 @@ class IloManagementTestCase(db_base.DbTestCase):
|
|||||||
clean_step_mock.assert_called_once_with(
|
clean_step_mock.assert_called_once_with(
|
||||||
task.node, 'activate_license', 'XXXXX-YYYYY-ZZZZZ-XYZZZ-XXYYZ')
|
task.node, 'activate_license', 'XXXXX-YYYYY-ZZZZZ-XYZZZ-XXYYZ')
|
||||||
|
|
||||||
@mock.patch.object(ilo_management, 'LOG', spec_set=True, autospec=True)
|
|
||||||
@mock.patch.object(ilo_management, '_execute_ilo_clean_step',
|
@mock.patch.object(ilo_management, '_execute_ilo_clean_step',
|
||||||
spec_set=True, autospec=True)
|
spec_set=True, autospec=True)
|
||||||
def test_activate_license_no_or_invalid_format_license_key(
|
def test_activate_license_no_or_invalid_format_license_key(
|
||||||
self, clean_step_mock, log_mock):
|
self, clean_step_mock):
|
||||||
with task_manager.acquire(self.context, self.node.uuid,
|
with task_manager.acquire(self.context, self.node.uuid,
|
||||||
shared=False) as task:
|
shared=False) as task:
|
||||||
for license_key_value in (None, [], {}):
|
for license_key_value in (None, [], {}):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user