File tree Expand file tree Collapse file tree 3 files changed +67
-1
lines changed Expand file tree Collapse file tree 3 files changed +67
-1
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,10 @@ def purchasePlaces():
5858 return render_template ('welcome.html' , club = club , competitions = competitions )
5959
6060
61- # TODO: Add route for points display
61+ # FONCTIONNALITÉ 2: Tableau d'affichage des points
62+ @app .route ('/pointsDisplay' )
63+ def pointsDisplay ():
64+ return render_template ('points_display.html' , clubs = clubs )
6265
6366
6467@app .route ('/logout' )
Original file line number Diff line number Diff line change 1+ < html lang ="en ">
2+ < head >
3+ < meta charset ="UTF-8 ">
4+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
5+ < title > Clubs Points | GUDLFT</ title >
6+ </ head >
7+ < body >
8+ < h1 > Clubs Points</ h1 >
9+ < a href ="{{url_for('index')}} "> Back to login</ a >
10+ < table >
11+ < thead >
12+ < tr >
13+ < th > Club</ th >
14+ < th > Points</ th >
15+ </ tr >
16+ </ thead >
17+ < tbody >
18+ {% for club in clubs %}
19+ < tr >
20+ < td > {{ club['name'] }}</ td >
21+ < td > {{ club['points'] }}</ td >
22+ </ tr >
23+ {% endfor %}
24+ </ tbody >
25+ </ table >
26+ </ body >
27+ </ html >
Original file line number Diff line number Diff line change 1+ import sys
2+ import os
3+ sys .path .append (os .path .abspath (os .path .join (os .path .dirname (__file__ ), '..' , '..' )))
4+ import pytest
5+ from server import app , clubs
6+
7+ @pytest .fixture
8+ def client ():
9+ app .config ['TESTING' ] = True
10+ with app .test_client () as client :
11+ yield client
12+
13+ def test_points_display_route (client ):
14+ """Test que la route /pointsDisplay renvoie le bon template avec les données"""
15+ response = client .get ('/pointsDisplay' )
16+ assert response .status_code == 200
17+ assert b"Clubs Points" in response .data
18+
19+ # Vérifier que tous les clubs sont affichés
20+ for club in clubs :
21+ assert club ['name' ].encode () in response .data
22+ assert club ['points' ].encode () in response .data
23+
24+ def test_points_display_content (client ):
25+ """Test le contenu spécifique du tableau des points"""
26+ response = client .get ('/pointsDisplay' )
27+
28+ # Vérifier le format du tableau
29+ assert b"<table>" in response .data
30+ assert b"<th>Club</th>" in response .data
31+ assert b"<th>Points</th>" in response .data
32+
33+ # Vérifier un club spécifique
34+ test_club = clubs [0 ]
35+ assert f"<td>{ test_club ['name' ]} </td>" .encode () in response .data
36+ assert f"<td>{ test_club ['points' ]} </td>" .encode () in response .data
You can’t perform that action at this time.
0 commit comments