Ejemplo n.º 1
0
 def testPutFailWrongSize(self):
     """check that you can't put too big an object in"""
     self.cmd.dirobj = actor1
     try:
         invoke(self.obj, IContainer, 'put', self.cmd, False)
     except pub.errors.SizeError:
         pass
Ejemplo n.º 2
0
 def testUnlockFailNotLocked(self):
     """check that you can't unlock what is not locked"""
     invoke(self.obj, ILockable, 'unlock')
     try:
         invoke(self.obj, ILockable, 'unlock', self.cmd, False)
     except pub.errors.StateError:
         pass
Ejemplo n.º 3
0
 def testGetFailSize(self):
     """check that you can't pick up too big items"""
     self.obj.moveTo(self.room)
     self.obj.size = 150
     #Test it
     try: invoke(self.obj, ICarriable, 'get', self.cmd)
     except pub.SizeError: pass
Ejemplo n.º 4
0
    def testLockFailLocked(self):
        """checks that a locked object returns an error if locked."""
        self.com.isLocked = True

        try: invoke(self.obj, ILockL, 'lock', self.cmd, False)
        except pub.errors.StateError: pass
        else: self.fail("Expected a StateError")
Ejemplo n.º 5
0
    def testAskFailNoAboutObj(self):
        """check that not having an aboutobj raises an error"""

        self.cmd.aboutobj = ''
        try: invoke(self.obj, IAskL, 'ask', self.cmd, False)
        except pub.errors.ObjError: pass
        else: self.fail("Expected an ObjError")
Ejemplo n.º 6
0
 def testPutFailOnSelf(self):
     """check that you can't put an object into itself."""
     self.cmd.dirobj = self.obj
     try:
         invoke(self.obj, IContainer, 'put', self.cmd, False)
     except pub.errors.TargetError:
         pass
Ejemplo n.º 7
0
 def testDropFailNotHave(self):
     """check that you need to have the object in your inventory"""
     self.obj.moveTo(self.room)
     #Test it
     try:
         invoke(self.obj, ICarriable, 'drop', self.cmd)
     except pub.InventoryError:
         pass
Ejemplo n.º 8
0
 def testUnlockFailNoKey(self):
     """check that not having the key returns an error"""
     invoke(self.obj, ILockable, 'lock')
     self.key.moveTo(self.room)
     try:
         invoke(self.obj, ILockable, 'unlock', self.cmd, False)
     except pub.errors.InventoryError:
         pass
Ejemplo n.º 9
0
    def testUnlockFailNotLocked(self):
        """check that unlocking a not locked object will result in an error"""
        
        self.obj.isLocked = False

        try: invoke(self.obj, IUnlockL, 'unlock', self.cmd, False)
        except pub.errors.StateError: pass
        else: self.fail("Expected a StateError")
Ejemplo n.º 10
0
 def testGetFailSize(self):
     """check that you can't pick up too big items"""
     self.obj.moveTo(self.room)
     self.obj.size = 150
     #Test it
     try:
         invoke(self.obj, ICarriable, 'get', self.cmd)
     except pub.SizeError:
         pass
Ejemplo n.º 11
0
 def testGiveFailNoToObj(self):
     """check that having no toObj raises an error"""
     self.cmd.toObj = ''
     try:
         invoke(self.obj, IGiveL, 'give', self.cmd, False)
     except pub.errors.ObjError:
         pass
     else:
         self.fail("Expected an ObjError")
Ejemplo n.º 12
0
    def testGoFailNoDest(self):
        """checks that you get an error when the exit doesn't have a room
        reference"""

        self.obj.dest = None

        try: invoke(self.obj, IGo, 'go', self.cmd, False)
        except pub.errors.DestinationError: pass
        else: self.fail('Expected a DestinationError')
Ejemplo n.º 13
0
 def testCloseFailOpen(self):
     """check that the test fails if the object is closed"""
     self.com.isOpen = False
     try:
         invoke(self.obj, ICloseL, 'close', self.cmd, False)
     except pub.errors.StateError:
         pass
     else:
         self.fail("Expected a StateError")
Ejemplo n.º 14
0
 def testDropFailNoInventory(self):
     """check that you can't drop what you don't have"""
     self.obj.moveTo(self.actor.getRoom())
     try:
         invoke(self.obj, IDropL, 'drop', self.cmd, False)
     except pub.errors.InventoryError:
         pass
     else:
         self.fail("Expected an InventoryError")
Ejemplo n.º 15
0
    def testLockFailLocked(self):
        """checks that a locked object returns an error if locked."""
        self.com.isLocked = True

        try:
            invoke(self.obj, ILockL, 'lock', self.cmd, False)
        except pub.errors.StateError:
            pass
        else:
            self.fail("Expected a StateError")
Ejemplo n.º 16
0
 def testGiveFailNotHave(self):
     """check that you need to have the object before giving it away"""
     self.obj.moveTo(self.room)
     
     self.actor2 = pub.objs.Actor()
     self.actor2.moveTo(self.room)
     self.cmd.dirobj = self.actor2
     #Test it
     try: invoke(self.obj, ICarriable, 'give', self.cmd)
     except pub.InventoryError: pass
Ejemplo n.º 17
0
    def testAskFailNoAboutObj(self):
        """check that not having an aboutobj raises an error"""

        self.cmd.aboutobj = ''
        try:
            invoke(self.obj, IAskL, 'ask', self.cmd, False)
        except pub.errors.ObjError:
            pass
        else:
            self.fail("Expected an ObjError")
Ejemplo n.º 18
0
    def testUnlockFailNotLocked(self):
        """check that unlocking a not locked object will result in an error"""

        self.obj.isLocked = False

        try:
            invoke(self.obj, IUnlockL, 'unlock', self.cmd, False)
        except pub.errors.StateError:
            pass
        else:
            self.fail("Expected a StateError")
Ejemplo n.º 19
0
    def testGiveFailNotHave(self):
        """check that you need to have the object before giving it away"""
        self.obj.moveTo(self.room)

        self.actor2 = pub.objs.Actor()
        self.actor2.moveTo(self.room)
        self.cmd.dirobj = self.actor2
        #Test it
        try:
            invoke(self.obj, ICarriable, 'give', self.cmd)
        except pub.InventoryError:
            pass
Ejemplo n.º 20
0
    def testGoFailNoDest(self):
        """checks that you get an error when the exit doesn't have a room
        reference"""

        self.obj.dest = None

        try:
            invoke(self.obj, IGo, 'go', self.cmd, False)
        except pub.errors.DestinationError:
            pass
        else:
            self.fail('Expected a DestinationError')
Ejemplo n.º 21
0
    def testGiveDone(self):
        """check that you can give away a normal object"""
        self.obj.moveTo(self.actor)

        self.actor2 = pub.objs.Actor()
        self.actor2.moveTo(self.room)
        self.cmd.dirobj = self.actor2
        #Test it
        self.assert_(invoke(self.obj, ICarriable, 'give', self.cmd))
Ejemplo n.º 22
0
 def testGiveDone(self):
     """check that you can give away a normal object"""
     self.obj.moveTo(self.actor)
     
     self.actor2 = pub.objs.Actor()
     self.actor2.moveTo(self.room)
     self.cmd.dirobj = self.actor2
     #Test it
     self.assert_(invoke(self.obj, ICarriable, 'give', self.cmd) )
Ejemplo n.º 23
0
 def testCloseFailClosed(self):
     invoke(self.obj, IOpenablel, 'close') # No cmdObject
     try: invoke(self.obj, IOpenable, 'close', self.cmd, False)
     except pub.errors.StateError: pass
Ejemplo n.º 24
0
 def testDropDone(self):
     """check that you can put the object into your own container."""
     self.obj.moveTo(self.actor)
     #Test it
     self.assert_(invoke(self.obj, ICarriable, 'drop', self.cmd))
Ejemplo n.º 25
0
 def testPutDone(self):
     """check that you can put an object somewhere."""
     self.cmd.dirobj = self.normObj
     self.assert_(invoke(self.obj, IContainer, 'put', self.cmd) )
Ejemplo n.º 26
0
 def testCanContain(self):
     """check that the container can contain the direct object"""
     self.assert_(invoke(self.obj, IContainer, 'canContain', self.cmd) )
Ejemplo n.º 27
0
 def testDropDone(self):
     """check that you can put the object into your own container."""
     self.obj.moveTo(self.actor)
     #Test it
     self.assert_(invoke(self.obj, ICarriable, 'drop', self.cmd) )
Ejemplo n.º 28
0
 def testReceiveDone(self):
     self.assert_(invoke(self.obj, ISentience, 'receive', self.cmd, False))
Ejemplo n.º 29
0
 def testGetDone(self):
     """check that you are able to pick up an object."""
     self.obj.moveTo(self.room)
     #Test it
     self.assert_(invoke(self.obj, ICarriable, 'get', self.cmd) )
Ejemplo n.º 30
0
 def testCloseDone(self):
     invoke(self.obj, IOpenable, 'open')
     self.assert_(invoke(self.obj, IOpenable, 'close', self.cmd, False))
Ejemplo n.º 31
0
 def testCloseFailClosed(self):
     invoke(self.obj, IOpenablel, 'close')  # No cmdObject
     try:
         invoke(self.obj, IOpenable, 'close', self.cmd, False)
     except pub.errors.StateError:
         pass
Ejemplo n.º 32
0
 def testOpenFailOpen(self):
     invoke(self.obj, IOpenable, 'open')  # No cmdObject
     try:
         invoke(self.obj, IOpenable, 'open', self.cmd, False)
     except pub.errors.StateError:
         pass
Ejemplo n.º 33
0
 def testOpenDone(self):
     invoke(self.obj, IOpenable, 'close')  # No cmdObject
     self.assert_(invoke(self.obj, IOpenable, 'open', self.cmd, False))
Ejemplo n.º 34
0
 def testGetDone(self):
     """check that you are able to pick up an object."""
     self.obj.moveTo(self.room)
     #Test it
     self.assert_(invoke(self.obj, ICarriable, 'get', self.cmd))
Ejemplo n.º 35
0
 def testContainNoCheck(self):
     """move direct object into container"""
     self.assert_(invoke(self.obj, IContainer, 'containNoCheck', self.cmd))
Ejemplo n.º 36
0
 def testCloseDone(self):
     """check that the component can be closed, given that it is open"""
     self.assert_(invoke(self.obj, ICloseL, 'close', self.cmd, False))
Ejemplo n.º 37
0
    def testWearL(self):
        """check that an object can be worn."""

        self.assert_(invoke(self.obj, IWearL, 'wear', self.cmd, False) )
Ejemplo n.º 38
0
 def testPutFailWrongSize(self):
     """check that you can't put too big an object in"""
     self.cmd.dirobj = actor1
     try: invoke(self.obj, IContainer, 'put', self.cmd, False)
     except pub.errors.SizeError: pass
Ejemplo n.º 39
0
 def testPutDone(self):
     """check that you can put an object somewhere."""
     self.cmd.dirobj = self.normObj
     self.assert_(invoke(self.obj, IContainer, 'put', self.cmd))
Ejemplo n.º 40
0
 def testLockDone(self):
     """check that you can lock the obj"""
     invoke(self.obj, ILockable, 'unlock')
     self.assert_(invoke(self.obj, ILockable, 'lock', self.cmd, False) )
Ejemplo n.º 41
0
 def testDropFailNotHave(self):
     """check that you need to have the object in your inventory"""
     self.obj.moveTo(self.room)
     #Test it
     try: invoke(self.obj, ICarriable, 'drop', self.cmd)
     except pub.InventoryError: pass
Ejemplo n.º 42
0
 def testUnlockFailNoKey(self):
     """check that not having the key returns an error"""
     invoke(self.obj, ILockable, 'lock')
     self.key.moveTo(self.room)
     try: invoke(self.obj, ILockable, 'unlock', self.cmd, False)
     except pub.errors.InventoryError: pass
Ejemplo n.º 43
0
    def testAskDone(self):
        """check that we can ask about things in the topics"""

        self.assert_(invoke(self.obj, IAskL, 'ask', self.cmd, False))
Ejemplo n.º 44
0
 def testLockDone(self):
     """check that you can lock the obj"""
     invoke(self.obj, ILockable, 'unlock')
     self.assert_(invoke(self.obj, ILockable, 'lock', self.cmd, False))
Ejemplo n.º 45
0
 def testContainNoCheck(self):
     """move direct object into container"""
     self.assert_(invoke(self.obj, IContainer, 'containNoCheck', self.cmd) 
     )
Ejemplo n.º 46
0
 def testOpenFailOpen(self):
     invoke(self.obj, IOpenable, 'open') # No cmdObject
     try: invoke(self.obj, IOpenable, 'open', self.cmd, False)
     except pub.errors.StateError: pass
Ejemplo n.º 47
0
 def testPutFailOnSelf(self):
     """check that you can't put an object into itself."""
     self.cmd.dirobj = self.obj
     try: invoke(self.obj, IContainer, 'put', self.cmd, False)
     except pub.errors.TargetError: pass
Ejemplo n.º 48
0
 def testUnlockDone(self):
     """check that the object can be unlocked"""
     invoke(self.obj, ILockable, 'lock')
     self.assert_(invoke(self.obj, ILockable, 'unlock', self.cmd, False))
Ejemplo n.º 49
0
    def testAskDone(self):
        """check that we can ask about things in the topics"""

        self.assert_(invoke(self.obj, IAskL, 'ask', self.cmd, False))
Ejemplo n.º 50
0
    def testWearL(self):
        """check that an object can be worn."""

        self.assert_(invoke(self.obj, IWearL, 'wear', self.cmd, False))
Ejemplo n.º 51
0
 def testUnlockDone(self):
     """check that the object can be unlocked"""
     invoke(self.obj, ILockable, 'lock')
     self.assert_(invoke(self.obj, ILockable, 'unlock', self.cmd, False) )
Ejemplo n.º 52
0
 def testReceiveDone(self):
     """test that you can receive an object."""
     
     self.assert_(invoke(self.obj, IReceiveL, 'receive', self.cmd, False) )
Ejemplo n.º 53
0
 def testUnlockFailNotLocked(self):
     """check that you can't unlock what is not locked"""
     invoke(self.obj, ILockable, 'unlock')
     try: invoke(self.obj, ILockable, 'unlock', self.cmd, False)
     except pub.errors.StateError: pass
Ejemplo n.º 54
0
    def testRemoveDone(self):
        """tests that an object can be removed"""

        self.assert_(invoke(self.obj, IRemoveL, 'remove', self.cmd, False) )
Ejemplo n.º 55
0
 def testOpenDone(self):
     invoke(self.obj, IOpenable, 'close') # No cmdObject
     self.assert_(invoke(self.obj, IOpenable, 'open', self.cmd, False) )
Ejemplo n.º 56
0
    def testTurnL(self):
        """check that an object can be turned."""

        self.assert_(invoke(self.obj, ITurnL, 'turn', self.cmd, False) )
Ejemplo n.º 57
0
 def testCloseDone(self):
     invoke(self.obj, IOpenable, 'open')
     self.assert_(invoke(self.obj, IOpenable, 'close', self.cmd, False) )
Ejemplo n.º 58
0
    def testUnlockLDone(self):
        """check that an object can be unlocked."""

        self.assert_(invoke(self.obj, IUnlockL, 'unlock', self.cmd, False) )
Ejemplo n.º 59
0
 def testReceiveDone(self):
     self.assert_(invoke(self.obj, ISentience, 'receive', self.cmd, False) )
Ejemplo n.º 60
0
 def testCanContain(self):
     """check that the container can contain the direct object"""
     self.assert_(invoke(self.obj, IContainer, 'canContain', self.cmd))