Ejemplo n.º 1
0
 def test_Delete(self):
     cmd = CommandManager()
     cmd.create_module('test_module', emulation.CreateAct, self.model)
     module = self.model.modules['test_module']
     cmd.delete_module(module, self.model)
     #verify module has been deleted
     self.assertNotIn('test_module', self.model.modules.keys())
     cmd.undo()
     self.assertIn('test_module', self.model.modules.keys())
     cmd.redo()
     self.assertNotIn('test_module', self.model.modules.keys())
Ejemplo n.º 2
0
 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())
Ejemplo n.º 3
0
 def test_Rename(self):
     cmd = CommandManager()
     cmd.create_module('test_module', emulation.CreateAct, self.model)
     module = self.model.modules['test_module']
     cmd.rename_module(module, 'test_module2')
     module3 = self.model.modules['test_module2']
     self.assertIs(module3, module)
     self.assertEqual(module3.name,'test_module2')
     self.assertNotIn('test_module', self.model.modules.keys())
     self.assertIn('test_module2', self.model.modules.keys())
     cmd.undo()
     self.assertEqual(module3.name,'test_module')
     self.assertIn('test_module', self.model.modules.keys())
     self.assertNotIn('test_module2', self.model.modules.keys())
     cmd.redo()
     self.assertEqual(module3.name,'test_module2')
     self.assertNotIn('test_module', self.model.modules.keys())
     self.assertIn('test_module2', self.model.modules.keys())