<s> '''<STR_LIT>''' <EOL> from __future__ import absolute_import <EOL> from salttesting import skipIf , TestCase <EOL> from salttesting . mock import ( <EOL> NO_MOCK , <EOL> NO_MOCK_REASON , <EOL> MagicMock , <EOL> patch <EOL> ) <EOL> from salttesting . helpers import ensure_in_syspath <EOL> ensure_in_syspath ( '<STR_LIT>' ) <EOL> from salt . states import serverdensity_device <EOL> serverdensity_device . __salt__ = { } <EOL> @ skipIf ( NO_MOCK , NO_MOCK_REASON ) <EOL> class ServerdensityDeviceTestCase ( TestCase ) : <EOL> '''<STR_LIT>''' <EOL> def test_monitored ( self ) : <EOL> '''<STR_LIT>''' <EOL> name = '<STR_LIT>' <EOL> ret = { '<STR_LIT:name>' : name , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT:result>' : True , <EOL> '<STR_LIT>' : '<STR_LIT>' } <EOL> mock_dict = MagicMock ( return_value = { '<STR_LIT:id>' : name } ) <EOL> mock_t = MagicMock ( side_effect = [ True , { '<STR_LIT>' : True } , <EOL> [ { '<STR_LIT>' : True } ] ] ) <EOL> mock_sd = MagicMock ( side_effect = [ [ '<STR_LIT>' ] , [ ] , True ] ) <EOL> with patch . dict ( serverdensity_device . __salt__ , <EOL> { '<STR_LIT>' : mock_dict , <EOL> '<STR_LIT>' : mock_dict , <EOL> '<STR_LIT>' : mock_t , <EOL> '<STR_LIT>' : mock_sd , <EOL> '<STR_LIT>' : mock_sd } ) : <EOL> comt = ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> ret . update ( { '<STR_LIT>' : comt } ) <EOL> self . assertDictEqual ( serverdensity_device . monitored ( name ) , ret ) <EOL> comt = ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> ret . update ( { '<STR_LIT>' : comt , '<STR_LIT>' : { '<STR_LIT>' : <EOL> { '<STR_LIT>' : True } , <EOL> '<STR_LIT>' : True } } ) <EOL> self . assertDictEqual ( serverdensity_device . monitored ( name ) , ret ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> from integration import run_tests <EOL> run_tests ( ServerdensityDeviceTestCase , needs_daemon = False ) </s>
