Beispiel #1
0
 def setUp(self):
     super().setUp()
     
     # finish GM data
     with db_session:
         gm = self.engine.main_db.GM(name='user123', url='url456', sid='123456')
         gm.postSetup()
     
     # create GM database
     self.db = orm.createGmDatabase(engine=self.engine, filename=':memory:')
Beispiel #2
0
    def connect_db(self):
        # connect to GM's database
        self.db = createGmDatabase(self.engine, str(self.db_path))

        # add all existing games to the cache
        with db_session:
            for game in self.db.Game.select():
                self.insert(game)
                # reorder scenes by ID if necessary
                if game.order == list():
                    game.reorderScenes()
Beispiel #3
0
    def setUp(self):
        super().setUp()

        with db_session:
            gm = self.engine.main_db.GM(name='user123',
                                        url='foo',
                                        sid='123456')
            gm.postSetup()
            self.cache = self.engine.cache.get(gm)

        # create GM database
        self.db = orm.createGmDatabase(engine=self.engine, filename=':memory:')
Beispiel #4
0
def fetchGameTimeids(paths, gm_url, engine):
    """ Fetch GM's games' time-IDs.
    """
    # load GM's database
    db_path = str(paths.getDatabasePath(gm_url))
    db = orm.createGmDatabase(engine, db_path)

    # iterate all games
    data = dict()
    with orm.db_session:
        for game in db.Game.select():
            data[game.url] = game.timeid

    return data
Beispiel #5
0
 def setUp(self):
     # create temporary database
     self.db = orm.createGmDatabase(engine=None, filename=':memory:')