def test_one_player_one_slot(self): with self.db_context(): db.insert_player(Player('Gary Gygax', 'TSR', {'1A': 'G'})) [players_table] = self.parse_tables(self.client.get('/players/')) self.assert_table_values(players_table, [ ['name', 'team', '1A'], ['Gary Gygax', 'TSR', 'G'], ])
def test_two_players_one_slot_each(self): with self.db_context(): db.insert_player(Player('Gary Gygax', 'TSR', {'1A': 'G'})) db.insert_player(Player('Dave Arneson', 'TSR', {'1B': 'G'})) [players_table] = self.parse_tables(self.client.get('/players/')) self.assert_table_values(players_table, [ ['name', 'team', '1A', '1B'], ['Gary Gygax', 'TSR', 'G', ''], ['Dave Arneson', 'TSR', '', 'G'], ])
def test_insert_player(self): self.assert_query([], 'SELECT * FROM players;') self.assert_query([], 'SELECT * FROM player_registrations;') db.insert_player(Player('Gary Gygax', 'TSR', {'1A': 'G'})) self.assert_query( [('Gary Gygax', 'TSR', '1A', 'G')], PLAYER_WITH_REG_QUERY)