

def test_latest(self):
    '\n            Test to Make sure the repository is cloned to\n            the given directory and is up to date\n        '
    ret = {
        'changes': {
            
        },
        'comment': '',
        'name': 'salt',
        'result': True,
    }
    mock = MagicMock(return_value=True)
    with patch.object(hg, '_fail', mock):
        self.assertTrue(hg.latest('salt'))
    mock = MagicMock(side_effect=[False, True, False, False, False, False])
    with patch.object(os.path, 'isdir', mock):
        mock = MagicMock(return_value=True)
        with patch.object(hg, '_handle_existing', mock):
            self.assertTrue(hg.latest('salt', target='c:\\salt'))
        with patch.dict(hg.__opts__, {
            'test': True,
        }):
            mock = MagicMock(return_value=True)
            with patch.object(hg, '_neutral_test', mock):
                ret.assertTrue(hg.latest('salt', target='c:\\salt'))
        with patch.dict(hg.__opts__, {
            'test': False,
        }):
            mock = MagicMock(return_value=True)
            with patch.object(hg, '_clone_repo', mock):
                self.assertDictEqual(hg.latest('salt', target='c:\\salt'), ret)

dataset/ETHPy150Open saltstack/salt/tests/unit/states/hg_test.py HgTestCase.test_latest/VarMisuse@198/299 `self`->`ret`