<s> '''<STR_LIT>''' <EOL> from __future__ import absolute_import <EOL> from salttesting import TestCase , skipIf <EOL> from salttesting . helpers import ensure_in_syspath <EOL> from salttesting . mock import ( <EOL> MagicMock , <EOL> patch , <EOL> NO_MOCK , <EOL> NO_MOCK_REASON <EOL> ) <EOL> ensure_in_syspath ( '<STR_LIT>' ) <EOL> from salt . states import win_servermanager <EOL> win_servermanager . __salt__ = { } <EOL> win_servermanager . __opts__ = { } <EOL> @ skipIf ( NO_MOCK , NO_MOCK_REASON ) <EOL> class WinServermanagerTestCase ( TestCase ) : <EOL> '''<STR_LIT>''' <EOL> def test_installed ( self ) : <EOL> '''<STR_LIT>''' <EOL> ret = { '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT:result>' : True , <EOL> '<STR_LIT>' : '<STR_LIT>' } <EOL> mock = MagicMock ( side_effect = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> mock1 = MagicMock ( return_value = { '<STR_LIT>' : True } ) <EOL> with patch . dict ( win_servermanager . __salt__ , <EOL> { "<STR_LIT>" : mock , <EOL> "<STR_LIT>" : mock1 } ) : <EOL> ret . update ( { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> self . assertDictEqual ( win_servermanager . installed ( '<STR_LIT>' ) , ret ) <EOL> with patch . dict ( win_servermanager . __opts__ , { "<STR_LIT:test>" : True } ) : <EOL> ret . update ( { '<STR_LIT>' : { '<STR_LIT>' : <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' } , '<STR_LIT:result>' : None , <EOL> '<STR_LIT>' : '<STR_LIT>' } ) <EOL> self . assertDictEqual ( win_servermanager . installed ( '<STR_LIT>' ) , ret ) <EOL> with patch . dict ( win_servermanager . __opts__ , { "<STR_LIT:test>" : False } ) : <EOL> ret . update ( { '<STR_LIT>' : { '<STR_LIT>' : { '<STR_LIT>' : True } } , <EOL> '<STR_LIT:result>' : True , '<STR_LIT>' : '<STR_LIT>' } ) <EOL> self . assertDictEqual ( win_servermanager . installed ( '<STR_LIT>' ) , <EOL> ret ) <EOL> def test_removed ( self ) : <EOL> '''<STR_LIT>''' <EOL> ret = { '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT:result>' : True , <EOL> '<STR_LIT>' : '<STR_LIT>' } <EOL> mock = MagicMock ( side_effect = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> mock1 = MagicMock ( return_value = { '<STR_LIT>' : True } ) <EOL> with patch . dict ( win_servermanager . __salt__ , <EOL> { "<STR_LIT>" : mock , <EOL> "<STR_LIT>" : mock1 } ) : <EOL> ret . update ( { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> self . assertDictEqual ( win_servermanager . removed ( '<STR_LIT>' ) , ret ) <EOL> with patch . dict ( win_servermanager . __opts__ , { "<STR_LIT:test>" : True } ) : <EOL> ret . update ( { '<STR_LIT>' : { '<STR_LIT>' : <EOL> '<STR_LIT>' } , <EOL> '<STR_LIT:result>' : None , '<STR_LIT>' : '<STR_LIT>' } ) <EOL> self . assertDictEqual ( win_servermanager . removed ( '<STR_LIT>' ) , ret ) <EOL> with patch . dict ( win_servermanager . __opts__ , { "<STR_LIT:test>" : False } ) : <EOL> ret . update ( { '<STR_LIT>' : { '<STR_LIT>' : { '<STR_LIT>' : True } } , <EOL> '<STR_LIT:result>' : True } ) <EOL> self . assertDictEqual ( win_servermanager . removed ( '<STR_LIT>' ) , <EOL> ret ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> from integration import run_tests <EOL> run_tests ( WinServermanagerTestCase , needs_daemon = False ) </s>
