def test_branches_new(self, _exists, _call): source = BzrURLs[0] dest = "foo" bh = BzrSourceHandler(source) self.assertTrue(bh.get(dest)) self.assertTrue(was_called_with_cmd(_call, ('bzr', 'branch', source, dest))) bh.checkout_branch = MagicMock(return_value=False) self.assertFalse(bh.get(dest))
def test_branches_new(self, _exists, _call): source = BzrURLs[0] dest = "foo" bh = BzrSourceHandler(source) self.assertTrue(bh.get(dest)) self.assertTrue( was_called_with_cmd(_call, ('bzr', 'branch', source, dest))) bh.checkout_branch = MagicMock(return_value=False) self.assertFalse(bh.get(dest))
def test_overwite(self, _rmtree, _exists, _log, _call): source = BzrURLs[0] dest = "foo" bh = BzrSourceHandler(source) bh.is_same_branch = MagicMock(return_value=False) # overwrite (delete) existing when asked options = {"overwrite": True} self.assertTrue(bh.get(dest, options)) _rmtree.assert_called_with(dest) bh.checkout_branch = MagicMock(return_value=False) self.assertFalse(bh.get(dest, options)) # don't overwrite if not asked options = {"overwrite": False} self.assertFalse(bh.get(dest, options)) _rmtree.assert_not_called() # don't overwrite if source = parent options = {"overwrite": True} bh.is_same_branch = MagicMock(return_value=True) self.assertTrue(bh.get(dest, options)) _rmtree.assert_not_called()
def test_overwite(self, _rmtree, _exists, _log, _call): source = BzrURLs[0] dest = "foo" bh = BzrSourceHandler(source) bh.is_same_branch = MagicMock(return_value=False) # overwrite (delete) existing when asked options = {"overwrite": True} self.assertTrue(bh.get(dest, options)) _rmtree.assert_called_with(dest) bh.checkout_branch = MagicMock(return_value=False) self.assertFalse(bh.get(dest, options)) # don't overwrite if not asked options = {"overwrite": False} self.assertFalse(bh.get(dest, options)) _rmtree.assert_not_called() # don't overwrite if source = parent options = {"overwrite": True} bh.is_same_branch = MagicMock(return_value=True) self.assertTrue(bh.get(dest, options)) _rmtree.assert_not_called()