def test_goto_command(self):
        from shinymud.models.area import Area
        from shinymud.data import config
        from shinymud.models.player import Player
        from shinymud.commands.commands import Goto
        blarg_area = Area.create({'name':'blarg'})
        foo_area = Area.create({'name':'foo'})
        blarg_room = blarg_area.new_room()
        foo_room = foo_area.new_room()
        bob = Player(('bob', 'bar'))
        bob.mode = None
        bob.playerize({'name':'bob', 'password':'pork'})
        self.world.player_add(bob)
        bob.permissions = bob.permissions | config.BUILDER
        generic_fail = 'Type "help goto" for help with this command.'
        
        # We should fail if we only specify a room number when we aren't in
        # an area 
        Goto(bob, foo_room.id % '%s', 'goto').run()
        self.assertEqual(bob.location, None)
        bob.world.log.debug(bob.outq)
        self.assertTrue(generic_fail in bob.outq)
        
        # We should fail if we try to go to a room in an area that doesn't 
        # exist
        message = 'Area "food" doesn\'t exist.'
        Goto(bob, '1 food', 'goto').run()
        self.assertEqual(bob.location, None)
        bob.world.log.debug(bob.outq)
        self.assertTrue(message in bob.outq)
        
        # We should fail if we try to go to a room that doesn't exist (in an
        # area that does)
        message = 'Room "4005" doesn\'t exist in area blarg.'
        Goto(bob, '4005 blarg', 'goto').run()
        self.assertEqual(bob.location, None)
        bob.world.log.debug(bob.outq)
        self.assertTrue(message in bob.outq)
        
        # We should succeed in going to a room and area that exists
        Goto(bob, '%s %s' % (foo_room.id, foo_room.area.name), 'goto').run()
        self.assertEqual(bob.location, foo_room)
        
        Goto(bob, '%s %s' % (blarg_room.id, blarg_room.area.name), 'goto').run()
        self.assertEqual(bob.location, blarg_room)
        
        blarg_r2 = blarg_area.new_room()
        Goto(bob, '%s' % (blarg_r2.id), 'goto').run()
        self.assertEqual(bob.location, blarg_r2)
        
        # We should get a help message if there is only white space given
        bob.outq = []
        Goto(bob, '   ', 'goto').run()
        fail = 'Type "help goto" for help with this command.'
        self.assertTrue(fail in bob.outq)
dataset/ETHPy150Open shinymud/ShinyMUD/tests/shinytest/commands/test_commands.py/TestGeneralCommands.test_goto_command/swapped operands of `%`