def test_verify_firmware_update_args_throws_for_no_firmware_url(self): # | GIVEN | update_firmware_mock = mock.MagicMock() firmware_update_args = { 'firmware_update_mode': 'ilo', 'firmware_images': [] } update_firmware_mock.__name__ = 'update_firmware_mock' wrapped_func = ( ilo_fw_processor.verify_firmware_update_args(update_firmware_mock)) # | WHEN & THEN | self.assertRaises(exception.InvalidParameterValue, wrapped_func, mock.ANY, mock.ANY, **firmware_update_args)
def test_verify_firmware_update_args_throws_for_invalid_update_mode(self): # | GIVEN | update_firmware_mock = mock.MagicMock() firmware_update_args = { 'firmware_update_mode': 'invalid_mode', 'firmware_images': None } # Note(deray): Need to set __name__ attribute explicitly to keep # ``functools.wraps`` happy. Passing this to the `name` argument at # the time creation of Mock doesn't help. update_firmware_mock.__name__ = 'update_firmware_mock' wrapped_func = ( ilo_fw_processor.verify_firmware_update_args(update_firmware_mock)) node_fake = mock.MagicMock(uuid='fake_node_uuid') task_fake = mock.MagicMock(node=node_fake) # | WHEN & THEN | self.assertRaises(exception.InvalidParameterValue, wrapped_func, mock.ANY, task_fake, **firmware_update_args)