def execute(self): """Execute the action Raises: :class:`fife_rpg.exceptions.NoSuchCommandError` if a command is detected that is not registered. """ lockable = getattr(self.target, Lockable.registered_as) unlock_lock(lockable) EntityAction.execute(self)
def testLockUnlock(self): lockable.lock_lock(self.lock.lockable) self.assertTrue(self.lock.lockable.locked) self.assertRaises(lockable.LockedError, lockable.open_lock, self.lock.lockable) lockable.unlock_lock(self.lock.lockable) self.assertFalse(self.lock.lockable.locked) lockable.open_lock(self.lock.lockable) self.assertRaises(lockable.OpenError, lockable.lock_lock, self.lock.lockable)