Exemple #1
0
class doAction(unittest.TestCase):
    """ Test cases of doAction """
    def setUp(self):
        """ Build the Attack Action """
        attack = AttackFactory.getAttackAsNew("TACKLE")
        self.priority = attack.speedDelegate.priority
        attack.use = self.use
        self.action = AttackAction(attack, None, None, None)
        self.usedAttack = False

    def attackUsed(self):
        """ Test that the wrapped attack is used """
        self.action.doAction()
        assert self.usedAttack, "Should have used the Action's Attack"

    def use(self, user, target, environment):
        self.usedAttack = True
class doAction(unittest.TestCase):
    """ Test cases of doAction """
    
    def  setUp(self):
        """ Build the Attack Action """
        attack = AttackFactory.getAttackAsNew("TACKLE")
        self.priority = attack.speedDelegate.priority
        attack.use = self.use
        self.action = AttackAction(attack, None, None, None)
        self.usedAttack = False
        
    def attackUsed(self):
        """ Test that the wrapped attack is used """
        self.action.doAction()
        assert self.usedAttack, "Should have used the Action's Attack"
        
    def use(self, user, target, environment):
        self.usedAttack = True