示例#1
0
 def test_status(self):
     """ Testing status functions
     status.get_round_from_db
     """
     clear_tables(self.db)
     assert(status.get_round_from_db(GAME_ID1, self.db) == -1)
     status.initialize_status(GAME_ID1, self.db, 3)
     assert(status.get_round_from_db(GAME_ID1, self.db) == 0)
     status.set_round_in_db(5, GAME_ID1, self.db)
     assert(status.get_round_from_db(GAME_ID1, self.db) == 5)
     status.initialize_status(GAME_ID1, self.db, 3)
     assert(status.get_round_from_db(GAME_ID1, self.db) == 0)
     table_str = status.create_player_rel_table(5)
     assert (len(table_str) == 74)
     table = status.get_table_from_rel_table(table_str)
     assert (len(table) == 5)
     assert (len(table[0]) == 5)
     tmp_table_str = status.get_rel_table_from_table(table)
     assert (tmp_table_str == table_str)
     tmp_table = status.get_table_from_rel_table(table_str)
     assert (tmp_table == table)
     new_table = status.update_player_rel_table(table_str, 1,2,5)
     status.set_player_rel_table_in_db(GAME_ID1, new_table, self.db)
     new_status = status.get_status_from_db(GAME_ID1, self.db)
     assert(status.get_table_from_rel_table(new_status.player_rel_table)[1][2] == '5')
示例#2
0
def enable_category(name, enabled, cur_player, game_id, db):
    """ input: target name: string
               enabled: boolean
               cur_player: string
    """
    cur_status = status.get_status_from_db(game_id, db)
    rel_table = status.get_table_from_rel_table(cur_status.player_rel_table)