コード例 #1
0
ファイル: test_web.py プロジェクト: jerith/table-minion
 def test_no_players_one_game_slot(self):
     with self.db_context():
         db.insert_game(self.make_game('1A'))
     [players_table] = self.parse_tables(self.client.get('/players/'))
     self.assert_table_values(players_table, [
         ['name', 'team', '1A'],
     ])
コード例 #2
0
ファイル: test_db.py プロジェクト: jerith/table-minion
 def test_insert_game(self):
     self.assert_query([], 'SELECT * FROM games;')
     db.insert_game(Game(
         '1A', 'Game 1A', 'Author 1A', 'System 1A', 'Blurb 1A', 4, 6))
     self.assert_query(
         [('1A', 'Game 1A', 'Author 1A', 'System 1A', 'Blurb 1A', 4, 6)],
         GAME_QUERY)
コード例 #3
0
ファイル: test_web.py プロジェクト: jerith/table-minion
 def test_one_game_5_players(self):
     with self.db_context():
         db.insert_game(self.make_game('1A', min_players=5, max_players=5))
     [games_table] = self.parse_tables(self.client.get('/games/'))
     self.assert_table_values(games_table, [
         ['slot', 'name', 'author', 'system', 'players'],
         [self.slot_link('1A'), 'Game 1A', 'Author 1A', 'System 1A', '5'],
     ])
コード例 #4
0
ファイル: test_web.py プロジェクト: jerith/table-minion
 def test_one_player_one_game_slot(self):
     with self.db_context():
         db.insert_game(self.make_game('1A'))
         db.insert_player(Player('Gary Gygax', 'TSR', {}))
     [players_table] = self.parse_tables(self.client.get('/players/'))
     self.assert_table_values(players_table, [
         ['name', 'team', '1A'],
         ['Gary Gygax', 'TSR', ''],
     ])
コード例 #5
0
ファイル: test_web.py プロジェクト: jerith/table-minion
 def test_game_5_players_no_tables(self):
     with self.db_context():
         db.insert_game(self.make_game('1A', min_players=5, max_players=5))
     response = self.client.get('/games/1A/')
     self.assertEqual(response.status_code, 200)
     self.assert_response_contains(response, '1A: Game 1A')
     self.assert_response_contains(response, 'Author: Author 1A')
     self.assert_response_contains(response, 'System: System 1A')
     self.assert_response_contains(response, 'Blurb: Blurb 1A')
     self.assert_response_contains(response, 'Players: 5')
     [tables_table] = self.parse_tables(response)
     self.assert_table_values(tables_table, [['tables'], []])
コード例 #6
0
ファイル: test_db.py プロジェクト: jerith/table-minion
    def test_import_games(self):
        db.insert_game(Game(
            '1X', 'Game 1X', 'Author 1X', 'System 1X', 'Blurb 1X', 4, 6))
        db.commit_db()
        self.assert_query(
            [('1X', 'Game 1X', 'Author 1X', 'System 1X', 'Blurb 1X', 4, 6)],
            GAME_QUERY)

        db.import_games(Games([
            Game('1A', 'Game 1A', 'Author 1A', 'System 1A', 'Blurb 1A', 4, 6),
            Game('1B', 'Game 1B', 'Author 1B', 'System 1B', 'Blurb 1B', 4, 6),
        ]))
        self.assert_query([
            ('1A', 'Game 1A', 'Author 1A', 'System 1A', 'Blurb 1A', 4, 6),
            ('1B', 'Game 1B', 'Author 1B', 'System 1B', 'Blurb 1B', 4, 6),
        ], GAME_QUERY)