def testLockUnlock(self): lockable.lock(self.lock.lockable) self.assertTrue(self.lock.lockable.locked) self.assertRaises(lockable.LockedError, lockable.open, self.lock.lockable) lockable.unlock(self.lock.lockable) self.assertFalse(self.lock.lockable.locked) lockable.open(self.lock.lockable) self.assertRaises(lockable.OpenError, lockable.lock, self.lock.lockable)
def execute(self): """Open the lockable.""" try: lockable.open(self.lockable.lockable) self.lockable.fifeagent.behaviour.animate("open") self.lockable.fifeagent.behaviour.queue_animation("opened", repeating=True) except lockable.LockedError: self.view.hud.createExamineBox(self.lockable.description.view_name, "Locked") Action.execute(self)
def testOpenClose(self): lockable.open(self.lock.lockable) self.assertFalse(self.lock.lockable.closed) lockable.close(self.lock.lockable) self.assertTrue(self.lock.lockable.closed)