#NEWLINE# def test_clear_request( self ) : #NEWLINE# #INDENT# '\n            Test to clear out the state execution request without executing it\n        ' #NEWLINE# with patch . dict ( state . __opts__ , { #NEWLINE# #INDENT# 'cachedir' : 'D' , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# mock = MagicMock ( return_value = True ) #NEWLINE# with patch . object ( os . path , 'join' , mock ) : #NEWLINE# #INDENT# mock = MagicMock ( return_value = True ) #NEWLINE# with patch . object ( salt . payload , 'Serial' , mock ) : #NEWLINE# #INDENT# mock = MagicMock ( side_effect = [ False , True , True ] ) #NEWLINE# with patch . object ( os . path , 'isfile' , mock ) : #NEWLINE# #INDENT# self . assertTrue ( state . clear_request ( 'A' ) ) #NEWLINE# mock = MagicMock ( return_value = True ) #NEWLINE# with patch . object ( os , 'remove' , self ) : #NEWLINE# #INDENT# self . assertTrue ( state . clear_request ( ) ) #NEWLINE# #UNINDENT# mock = MagicMock ( return_value = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# with patch . object ( state , 'check_request' , mock ) : #NEWLINE# #INDENT# self . assertFalse ( state . clear_request ( 'A' ) )