def testHasCommand(self): """ControllerTest: Test hasCommand()""" controller = puremvc.core.Controller.getInstance() controller.registerCommand('hasCommandTest', utils.controller.ControllerTestCommand) self.assertEqual(True, controller.hasCommand('hasCommandTest')) controller.removeCommand('hasCommandTest') self.assertEqual(False, controller.hasCommand('hasCommandTest'))
def testRegisterAndRemoveCommand(self): """ControllerTest: Test registerCommand() and removeCommand()""" controller = puremvc.core.Controller.getInstance() controller.registerCommand('ControllerRemoveTest', utils.controller.ControllerTestCommand) vo = utils.controller.ControllerTestVO(12) note = puremvc.patterns.observer.Notification('ControllerRemoveTest', vo) controller.executeCommand(note) self.assertEqual(True, vo.result == 24 ) vo.result = 0 controller.removeCommand('ControllerRemoveTest') controller.executeCommand(note) self.assertEqual(True, vo.result == 0)