<s> '''<STR_LIT>''' <EOL> from __future__ import absolute_import <EOL> from salttesting import TestCase , skipIf <EOL> from salttesting . mock import ( <EOL> MagicMock , <EOL> patch , <EOL> NO_MOCK , <EOL> NO_MOCK_REASON <EOL> ) <EOL> from salt . modules import hg <EOL> hg . __salt__ = { } <EOL> @ skipIf ( NO_MOCK , NO_MOCK_REASON ) <EOL> class HgTestCase ( TestCase ) : <EOL> '''<STR_LIT>''' <EOL> def test_revision ( self ) : <EOL> '''<STR_LIT>''' <EOL> mock = MagicMock ( side_effect = [ { '<STR_LIT>' : <NUM_LIT:0> , '<STR_LIT>' : '<STR_LIT:A>' } , <EOL> { '<STR_LIT>' : <NUM_LIT:1> , '<STR_LIT>' : '<STR_LIT:A>' } ] ) <EOL> with patch . dict ( hg . __salt__ , { '<STR_LIT>' : mock } ) : <EOL> self . assertEqual ( hg . revision ( '<STR_LIT>' ) , '<STR_LIT:A>' ) <EOL> self . assertEqual ( hg . revision ( '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> def test_describe ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . dict ( hg . __salt__ , { '<STR_LIT>' : <EOL> MagicMock ( return_value = '<STR_LIT:A>' ) } ) : <EOL> with patch . object ( hg , '<STR_LIT>' , return_value = False ) : <EOL> self . assertEqual ( hg . describe ( '<STR_LIT>' ) , '<STR_LIT:A>' ) <EOL> def test_archive ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . dict ( hg . __salt__ , { '<STR_LIT>' : <EOL> MagicMock ( return_value = '<STR_LIT:A>' ) } ) : <EOL> self . assertEqual ( hg . archive ( '<STR_LIT>' , '<STR_LIT>' ) , '<STR_LIT:A>' ) <EOL> def test_pull ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . dict ( hg . __salt__ , { '<STR_LIT>' : <EOL> MagicMock ( return_value = '<STR_LIT:A>' ) } ) : <EOL> self . assertEqual ( hg . pull ( '<STR_LIT>' ) , '<STR_LIT:A>' ) <EOL> def test_update ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . dict ( hg . __salt__ , { '<STR_LIT>' : <EOL> MagicMock ( return_value = '<STR_LIT:A>' ) } ) : <EOL> self . assertEqual ( hg . update ( '<STR_LIT>' , '<STR_LIT>' ) , '<STR_LIT:A>' ) <EOL> def test_clone ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . dict ( hg . __salt__ , { '<STR_LIT>' : <EOL> MagicMock ( return_value = '<STR_LIT:A>' ) } ) : <EOL> self . assertEqual ( hg . clone ( '<STR_LIT>' , '<STR_LIT>' ) , '<STR_LIT:A>' ) <EOL> def test_status_single ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . dict ( hg . __salt__ , { '<STR_LIT>' : <EOL> MagicMock ( return_value = ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) ) } ) : <EOL> self . assertEqual ( hg . status ( '<STR_LIT>' ) , { <EOL> '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> } ) <EOL> def test_status_multiple ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . dict ( hg . __salt__ , { <EOL> '<STR_LIT>' : MagicMock ( side_effect = ( <EOL> lambda * args , ** kwargs : { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } [ kwargs [ '<STR_LIT>' ] ] ) ) } ) : <EOL> self . assertEqual ( hg . status ( [ '<STR_LIT>' , '<STR_LIT>' ] ) , { <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ '<STR_LIT>' ] } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ '<STR_LIT>' ] } , <EOL> } ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> from integration import run_tests <EOL> run_tests ( HgTestCase , needs_daemon = False ) </s>
