#NEWLINE# def test_install( self ) : #NEWLINE# #INDENT# '\n        Test for Install composer dependencies for a directory.\n        ' #NEWLINE# mock = MagicMock ( return_value = False ) #NEWLINE# with patch . object ( composer , '_valid_composer' , mock ) : #NEWLINE# #INDENT# self . assertRaises ( CommandNotFoundError , composer . install , 'd' ) #NEWLINE# #UNINDENT# mock = MagicMock ( return_value = True ) #NEWLINE# with patch . object ( composer , '_valid_composer' , mock ) : #NEWLINE# #INDENT# self . assertRaises ( SaltInvocationError , composer . install , None ) #NEWLINE# #UNINDENT# mock = MagicMock ( return_value = True ) #NEWLINE# with patch . object ( composer , '_valid_composer' , mock ) : #NEWLINE# #INDENT# mock = MagicMock ( return_value = { #NEWLINE# #INDENT# 'retcode' : 1 , #NEWLINE# 'stderr' : 'A' , #NEWLINE# #UNINDENT# } ) #NEWLINE# with patch . dict ( composer . __salt__ , { #NEWLINE# #INDENT# 'cmd.run_all' : mock , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# self . assertRaises ( CommandExecutionError , composer . install , 'd' ) #NEWLINE# #UNINDENT# #UNINDENT# mock = MagicMock ( return_value = True ) #NEWLINE# with patch . object ( composer , '_valid_composer' , mock ) : #NEWLINE# #INDENT# mock = MagicMock ( return_value = { #NEWLINE# #INDENT# 'retcode' : 0 , #NEWLINE# 'stderr' : 'A' , #NEWLINE# #UNINDENT# } ) #NEWLINE# with patch . dict ( composer . __salt__ , { #NEWLINE# #INDENT# 'cmd.run_all' : mock , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# self . assertTrue ( composer . install ( 'dir' , None , None , None , None , None , None , None , None , None , True ) ) #NEWLINE# #UNINDENT# #UNINDENT# mock = MagicMock ( return_value = True ) #NEWLINE# with patch . object ( composer , '_valid_composer' , mock ) : #NEWLINE# #INDENT# rval = { #NEWLINE# #INDENT# 'retcode' : 0 , #NEWLINE# 'stderr' : 'A' , #NEWLINE# 'stdout' : 'B' , #NEWLINE# #UNINDENT# } #NEWLINE# mock = MagicMock ( return_value = rval ) #NEWLINE# with patch . dict ( composer . __salt__ , { #NEWLINE# #INDENT# 'cmd.run_all' : mock , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# self . assertEqual ( composer . install ( 'dir' ) , rval )