#NEWLINE# def test_all_validator( self ) : #NEWLINE# #INDENT# cls = images . SaharaAllValidator #NEWLINE# always_tells_the_truth = mock . Mock ( ) #NEWLINE# validator = cls ( [ always_tells_the_truth , always_tells_the_truth ] ) #NEWLINE# validator . validate ( None , reconcile = True ) #NEWLINE# self . assertEqual ( always_tells_the_truth . validate . call_count , 2 ) #NEWLINE# always_tells_the_truth . validate . assert_called_with ( None , reconcile = True , env_map = None ) #NEWLINE# always_tells_the_truth = mock . Mock ( ) #NEWLINE# always_lies = mock . Mock ( validate = mock . Mock ( side_effect = p_ex . ImageValidationError ( 'Boom!' ) ) ) #NEWLINE# validator = cls ( [ always_tells_the_truth , always_lies ] ) #NEWLINE# try : #NEWLINE# #INDENT# validator . validate ( None , reconcile = False ) #NEWLINE# #UNINDENT# except p_ex . ImageValidationError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# self . assertEqual ( always_tells_the_truth . validate . call_count , 1 ) #NEWLINE# self . assertEqual ( always_lies . validate . call_count , 1 ) #NEWLINE# always_tells_the_truth . validate . assert_called_with ( None , reconcile = False , env_map = None ) #NEWLINE# always_lies . validate . assert_called_with ( None , reconcile = False , env_map = None ) #NEWLINE# always_tells_the_truth = mock . Mock ( ) #NEWLINE# always_lies = mock . Mock ( validate = mock . Mock ( side_effect = p_ex . ImageValidationError ( 'Boom!' ) ) ) #NEWLINE# validator = cls ( [ always_lies , always_tells_the_truth ] ) #NEWLINE# try : #NEWLINE# #INDENT# validator . validate ( None , reconcile = False , env_map = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# except p_ex . ImageValidationError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# self . assertEqual ( cls . validate . call_count , 1 ) #NEWLINE# always_lies . validate . assert_called_with ( None , reconcile = False , env_map = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( always_tells_the_truth . validate . call_count , 0 )