def _init_world(self): """ We need the nicks in the channel in order to initialize the world. """ db_path = conf.supybot.directories.data.dirize(SQLITE_DB_FILENAME) if self.db is None: database = Database(path=db_path, log=log) self.db = database.get_connection() assert self.db is not None if self.SpiffyWorld is None: log.info("Initializing world.") worldbuilder = Worldbuilder(db=self.db, irc=self.irc, ircmsgs=ircmsgs, ircutils=ircutils, log=log) spiffy_world = worldbuilder.build_world() self.SpiffyWorld = spiffy_world self._add_players_from_channel(new_player_nick=None) assert self.SpiffyWorld is not None
def test_build_world(self): with LogCapture(): logger = logging.getLogger() worldbuilder = Worldbuilder(db=self.db, irc="quux", ircutils="quux", ircmsgs="quux", log=logger) world = worldbuilder.build_world() self.assertIsInstance(world, World) self.assertTrue(world.dungeon_collection) self.assertTrue(world.dungeon_collection.dungeons) for dungeon in world.dungeon_collection.dungeons: self.assertTrue(dungeon.name) self.assertTrue(dungeon.units) self.assertTrue(world.unit_collection) self.assertTrue(world.effect_collection) self.assertTrue(world.dialogue_collection) self.assertTrue(world.item_collection)