<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> from salttesting . helpers import ensure_in_syspath <EOL> ensure_in_syspath ( '<STR_LIT>' ) <EOL> from salt . modules import smf <EOL> smf . __salt__ = { } <EOL> @ skipIf ( NO_MOCK , NO_MOCK_REASON ) <EOL> class SmfTestCase ( TestCase ) : <EOL> '''<STR_LIT>''' <EOL> def test_get_running ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . dict ( smf . __salt__ , { '<STR_LIT>' : <EOL> MagicMock ( return_value = '<STR_LIT>' ) } ) : <EOL> self . assertEqual ( smf . get_running ( ) , [ '<STR_LIT:A>' ] ) <EOL> def test_get_stopped ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . dict ( smf . __salt__ , <EOL> { '<STR_LIT>' : MagicMock ( return_value = '<STR_LIT>' ) } ) : <EOL> self . assertListEqual ( smf . get_stopped ( ) , [ '<STR_LIT:A>' ] ) <EOL> def test_available ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . dict ( smf . __salt__ , { '<STR_LIT>' : MagicMock ( return_value = '<STR_LIT:A>' ) } ) : <EOL> with patch . object ( smf , '<STR_LIT>' , return_value = ( '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( smf . available ( '<STR_LIT:A>' ) ) <EOL> def test_missing ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . dict ( smf . __salt__ , { '<STR_LIT>' : MagicMock ( return_value = '<STR_LIT:A>' ) } ) : <EOL> with patch . object ( smf , '<STR_LIT>' , return_value = ( '<STR_LIT:A>' ) ) : <EOL> self . assertFalse ( smf . missing ( '<STR_LIT:A>' ) ) <EOL> def test_get_all ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . dict ( smf . __salt__ , <EOL> { '<STR_LIT>' : MagicMock ( return_value = '<STR_LIT>' ) } ) : <EOL> self . assertListEqual ( smf . get_all ( ) , [ '<STR_LIT:A>' ] ) <EOL> def test_start ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . dict ( smf . __salt__ , <EOL> { '<STR_LIT>' : MagicMock ( side_effect = [ False , <NUM_LIT:3> , None , <EOL> False , <NUM_LIT:4> ] ) } ) : <EOL> self . assertTrue ( smf . start ( '<STR_LIT:name>' ) ) <EOL> self . assertTrue ( smf . start ( '<STR_LIT:name>' ) ) <EOL> self . assertFalse ( smf . start ( '<STR_LIT:name>' ) ) <EOL> def test_stop ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . dict ( smf . __salt__ , <EOL> { '<STR_LIT>' : MagicMock ( return_value = False ) } ) : <EOL> self . assertTrue ( smf . stop ( '<STR_LIT:name>' ) ) <EOL> def test_restart ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . dict ( smf . __salt__ , <EOL> { '<STR_LIT>' : MagicMock ( side_effect = [ False , True ] ) } ) : <EOL> with patch . object ( smf , '<STR_LIT:start>' , return_value = '<STR_LIT:A>' ) : <EOL> self . assertEqual ( smf . restart ( '<STR_LIT:name>' ) , '<STR_LIT:A>' ) <EOL> self . assertFalse ( smf . restart ( '<STR_LIT:name>' ) ) <EOL> def test_reload_ ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . dict ( smf . __salt__ , <EOL> { '<STR_LIT>' : MagicMock ( side_effect = [ False , True ] ) } ) : <EOL> with patch . object ( smf , '<STR_LIT:start>' , return_value = '<STR_LIT:A>' ) : <EOL> self . assertEqual ( smf . reload_ ( '<STR_LIT:name>' ) , '<STR_LIT:A>' ) <EOL> self . assertFalse ( smf . reload_ ( '<STR_LIT:name>' ) ) <EOL> def test_status ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . dict ( smf . __salt__ , <EOL> { '<STR_LIT>' : MagicMock ( side_effect = [ '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) } ) : <EOL> self . assertTrue ( smf . status ( '<STR_LIT:name>' ) ) <EOL> self . assertFalse ( smf . status ( '<STR_LIT:name>' ) ) <EOL> def test_enable ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . dict ( smf . __salt__ , <EOL> { '<STR_LIT>' : MagicMock ( return_value = False ) } ) : <EOL> self . assertTrue ( smf . enable ( '<STR_LIT:name>' ) ) <EOL> def test_disable ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . dict ( smf . __salt__ , <EOL> { '<STR_LIT>' : MagicMock ( return_value = False ) } ) : <EOL> self . assertTrue ( smf . disable ( '<STR_LIT:name>' ) ) <EOL> def test_enabled ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . dict ( smf . __salt__ , <EOL> { '<STR_LIT>' : MagicMock ( side_effect = [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) } ) : <EOL> self . assertTrue ( smf . enabled ( '<STR_LIT:name>' ) ) <EOL> self . assertFalse ( smf . enabled ( '<STR_LIT:name>' ) ) <EOL> def test_disabled ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . object ( smf , '<STR_LIT>' , return_value = False ) : <EOL> self . assertTrue ( smf . disabled ( '<STR_LIT:name>' ) ) <EOL> def test_get_enabled ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . object ( smf , '<STR_LIT>' , return_value = True ) : <EOL> self . assertTrue ( smf . get_enabled ( ) ) <EOL> def test_get_disabled ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . object ( smf , '<STR_LIT>' , return_value = True ) : <EOL> self . assertTrue ( smf . get_disabled ( ) ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> from integration import run_tests <EOL> run_tests ( SmfTestCase , needs_daemon = False ) </s>
