def test_Create(self): cmd = CommandManager() cmd.create_module('test_module', emulation.CreateAct, self.model) #verify that the module has been created module = self.model.modules['test_module'] self.assertIsInstance(module, emulation.CreateAct) self.assertTrue(cmd.can_undo()) self.assertFalse(cmd.can_redo()) cmd.undo() self.assertNotIn('test_module', self.model.modules.keys()) self.assertFalse(cmd.can_undo()) self.assertTrue(cmd.can_redo()) cmd.redo() module2 = self.model.modules['test_module'] self.assertEqual(module, module2) self.assertTrue(cmd.can_undo()) self.assertFalse(cmd.can_redo())
def test_Init(self): cmd = CommandManager() #verify the can undo and can redo return false self.assertFalse(cmd.can_undo()) self.assertFalse(cmd.can_redo())