#NEWLINE# def test_highstate( self ) : #NEWLINE# #INDENT# '\n            Test to retrieve the state data from the\n            salt master for the minion and execute it\n        ' #NEWLINE# arg = 'whitelist=sls1.sls' #NEWLINE# mock = MagicMock ( side_effect = [ True , False , False , False ] ) #NEWLINE# with patch . object ( state , '_disabled' , mock ) : #NEWLINE# #INDENT# self . assertDictEqual ( state . highstate ( 'whitelist=sls1.sls' ) , { #NEWLINE# #INDENT# 'comment' : 'Disabled' , #NEWLINE# 'name' : 'Salt highstate run is disabled. To re-enable, run state.enable highstate' , #NEWLINE# 'result' : 'False' , #NEWLINE# #UNINDENT# } ) #NEWLINE# mock = MagicMock ( side_effect = [ 'A' , None , None ] ) #NEWLINE# with patch . object ( state , '_check_queue' , mock ) : #NEWLINE# #INDENT# self . assertEqual ( state . highstate ( 'whitelist=sls1.sls' ) , 'A' ) #NEWLINE# with patch . dict ( state . __opts__ , { #NEWLINE# #INDENT# 'test' : 'A' , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# mock = MagicMock ( return_value = { #NEWLINE# #INDENT# 'test' : True , #NEWLINE# #UNINDENT# } ) #NEWLINE# with patch . object ( state , '_get_opts' , mock ) : #NEWLINE# #INDENT# self . assertRaises ( SaltInvocationError , state . highstate , 'whitelist=sls1.sls' , pillar = 'A' ) #NEWLINE# mock = MagicMock ( return_value = True ) #NEWLINE# with patch . dict ( state . __salt__ , { #NEWLINE# #INDENT# 'config.option' : mock , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# mock = MagicMock ( return_value = 'A' ) #NEWLINE# with patch . object ( state , '_filter_running' , mock ) : #NEWLINE# #INDENT# mock = MagicMock ( return_value = True ) #NEWLINE# with patch . object ( state , '_filter_running' , mock ) : #NEWLINE# #INDENT# mock = MagicMock ( return_value = True ) #NEWLINE# with patch . object ( salt . payload , 'Serial' , mock ) : #NEWLINE# #INDENT# with patch . dict ( state . __opts__ , { #NEWLINE# #INDENT# 'cachedir' : 'D' , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# with patch . object ( os . path , 'join' , mock ) : #NEWLINE# #INDENT# with patch . object ( state , '_set_retcode' , self ) : #NEWLINE# #INDENT# self . assertTrue ( state . highstate ( arg ) )