#NEWLINE# @ patch ( 'salt.minion.Matcher' ) #NEWLINE# def test_grain_pcre( self , mock_matcher ) : #NEWLINE# #INDENT# '\n        Test for Return True if the minion matches the given grain_pcre target\n        ' #NEWLINE# with patch . dict ( match . __grains__ , { #NEWLINE# #INDENT# 'id' : 101 , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# mock_matcher . side_effect = MagicMock ( ) #NEWLINE# with patch . object ( mock_matcher , 'grain_pcre_match' , MagicMock ( ) ) : #NEWLINE# #INDENT# self . assertTrue ( match . grain_pcre ( 'tgt' ) ) #NEWLINE# #UNINDENT# mock_matcher . side_effect = MagicMock ( return_value = 'B' ) #NEWLINE# self . assertFalse ( match . grain_pcre ( 'tgt' ) )