#NEWLINE# def test_freeze_command( self ) : #NEWLINE# #INDENT# eggs = [ 'M2Crypto==0.21.1' , '-e git+git@github.com:s0undt3ch/salt-testing.git@9ed81aa2f918d59d3706e56b18f0782d1ea43bf8#egg=SaltTesting-dev' , 'bbfreeze==1.1.0' , 'bbfreeze-loader==1.1.0' , 'pycrypto==2.6' ] #NEWLINE# mock = MagicMock ( return_value = { #NEWLINE# #INDENT# 'retcode' : 0 , #NEWLINE# 'stdout' : '\n' . join ( eggs ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# with patch . dict ( pip . __salt__ , { #NEWLINE# #INDENT# 'cmd.run_all' : mock , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# ret = pip . freeze ( ) #NEWLINE# mock . assert_called_once_with ( [ 'pip' , 'freeze' ] , cwd = None , runas = None , use_vt = False , python_shell = False ) #NEWLINE# self . assertEqual ( ret , eggs ) #NEWLINE# #UNINDENT# mock = MagicMock ( return_value = { #NEWLINE# #INDENT# 'retcode' : 1 , #NEWLINE# 'stderr' : 'CABOOOOMMM!' , #NEWLINE# #UNINDENT# } ) #NEWLINE# with patch . dict ( pip . __salt__ , { #NEWLINE# #INDENT# 'cmd.run_all' : mock , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# self . assertRaises ( CommandExecutionError , pip . freeze )