#NEWLINE# def test_should_raise_exception_if_cannot_update_binding( self ) : #NEWLINE# #INDENT# def read_func( jboss_config , binding_name , profile ) : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# 'success' : True , #NEWLINE# 'result' : { #NEWLINE# #INDENT# 'value' : 'DEV' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# def update_func( jboss_config , binding_name , value , profile ) : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# 'success' : False , #NEWLINE# 'failure-description' : 'Incorrect binding name.' , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# __salt__ [ 'jboss7.read_simple_binding' ] = MagicMock ( side_effect = read_func ) #NEWLINE# __salt__ [ 'jboss7.update_simple_binding' ] = MagicMock ( side_effect = update_func ) #NEWLINE# try : #NEWLINE# #INDENT# jboss7 . bindings_exist ( name = 'bindings' , jboss_config = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , bindings = { #NEWLINE# #INDENT# 'env' : '!@#!///some weird value' , #NEWLINE# #UNINDENT# } , profile = None ) #NEWLINE# self . fail ( 'An exception should be thrown' ) #NEWLINE# #UNINDENT# except CommandExecutionError as e : #NEWLINE# #INDENT# self . assertEqual ( str ( e ) , 'Incorrect binding name.' )