#NEWLINE# def test_if_instance_restart_fails_error_message_is_saved( self , mock_backend , mock_throttle ) : #NEWLINE# #INDENT# self . instance . state = Instance . States . RESTARTING_SCHEDULED #NEWLINE# self . instance . save ( ) #NEWLINE# mock_backend ( ) . restart_instance . side_effect = mock_throttle . error #NEWLINE# with self . assertRaises ( OpenStackBackendError ) : #NEWLINE# #INDENT# tasks . restart_instance ( self . instance . uuid . hex ) #NEWLINE# #UNINDENT# self . assert_instance_has_error_message ( )