def test_redo_redoes_changes(self): rename(self.proj, self.task_state, 'Llama', 'basic/foo.py', 8) with self.assertRaises(ValueError): common.compare_projects( 'basic', 'main', 'basic') history.undo(self.proj) common.compare_projects( 'basic', 'main', 'basic') history.redo(self.proj) with self.assertRaises(ValueError): common.compare_projects( 'basic', 'main', 'basic')
def undo_view(): from traad.rope.history import undo args = request.json undo(project, args['index']) # TODO: What if it actually fails? return {'result': 'success'}
def test_redo_adds_history(self): rename(self.proj, self.task_state, 'Llama', 'basic/foo.py', 8) self.assertEqual(len(self.proj.proj.history.redo_list), 0) history.undo(self.proj) self.assertEqual(len(self.proj.proj.history.redo_list), 1)
def test_redo_info(self): rename(self.proj, self.task_state, 'Llama', 'basic/foo.py', 8) history.undo(self.proj) i = history.redo_info(self.proj, 0) for k in ['description', 'time', 'full_change', 'changes']: self.assertIn(k, i)
def test_redo_history(self): self.assertEqual( len(history.redo_history(self.proj)), 0) rename(self.proj, self.task_state, 'Llama', 'basic/foo.py', 8) history.undo(self.proj) self.assertEqual( len(history.redo_history(self.proj)), 1)
def test_redo_info_exceptions(self): with self.assertRaises(IndexError): history.redo_info(self.proj, 0) rename(self.proj, self.task_state, 'Llama', 'basic/foo.py', 8) history.undo(self.proj) history.redo_info(self.proj, 0) with self.assertRaises(IndexError): history.redo_info(self.proj, 1)