fix(audit): fermer les frontieres restantes
This commit is contained in:
@@ -233,6 +233,42 @@ class TestPendingEvaluations:
|
||||
assert self._pending(client) == 1
|
||||
|
||||
|
||||
class TestRegisteredPlayersForMatchForm:
|
||||
"""The match forms used to issue one or two user lookups per registration."""
|
||||
|
||||
def test_the_result_is_unique_ordered_and_constant_cost(self, app, make_user, count_queries):
|
||||
admin_id = make_user('admin')
|
||||
player_ids = [make_user('player', username=name) for name in ('zulu', 'alpha', 'mike')]
|
||||
|
||||
with app.app_context():
|
||||
tryout = Tryout(
|
||||
title='Match form',
|
||||
game='Valorant',
|
||||
date=date(2030, 3, 1),
|
||||
created_by=admin_id,
|
||||
)
|
||||
db.session.add(tryout)
|
||||
db.session.flush()
|
||||
for player_id in player_ids:
|
||||
db.session.add(TryoutRegistration(tryout_id=tryout.id, player_id=player_id))
|
||||
# DB-006 is pending, so prove the UI remains unique even when the
|
||||
# current database already contains a duplicate registration.
|
||||
db.session.add(TryoutRegistration(tryout_id=tryout.id, player_id=player_ids[0]))
|
||||
db.session.commit()
|
||||
tryout_id = tryout.id
|
||||
|
||||
from app.routes.matches import registered_players
|
||||
|
||||
counter = count_queries()
|
||||
try:
|
||||
players = registered_players(tryout_id)
|
||||
finally:
|
||||
counter.stop()
|
||||
|
||||
assert [player.username for player in players] == ['alpha', 'mike', 'zulu']
|
||||
assert counter.total == 1
|
||||
|
||||
|
||||
class TestViewTryout:
|
||||
"""PERF-001 — the most-visited page in the application ran one query
|
||||
per registration, one per player evaluated, one per team, and one per
|
||||
|
||||
Reference in New Issue
Block a user