diff --git a/server.py b/server.py index f8f1ec351..e48093220 100644 --- a/server.py +++ b/server.py @@ -35,7 +35,9 @@ def showSummary(): return render_template('welcome.html', club=club[0], - competitions=competitions) + competitions=competitions, + clubs=clubs) + @app.route('/book//') diff --git a/templates/welcome.html b/templates/welcome.html index d2ea76a30..e0f43b555 100644 --- a/templates/welcome.html +++ b/templates/welcome.html @@ -30,10 +30,22 @@

Competitions:

Book Places {%endif%} -
+ {% endfor %} + + +

Clubs:

+ {%endwith%} +
\ No newline at end of file diff --git a/test/test_server.py b/test/test_server.py index 5a096aa7a..673579b25 100644 --- a/test/test_server.py +++ b/test/test_server.py @@ -18,6 +18,7 @@ def test_show_summary_with_unknown_email(client): + def test_purchase_places_with_valid_number_of_places(client): response = client.post("/purchasePlaces", data={ "competition": "Spring Festival", @@ -41,6 +42,7 @@ def test_purchase_places_with_too_many_places(client): + def test_book_less_or_12_places(client, booking_test_data): club_test, competition_test = booking_test_data @@ -82,7 +84,6 @@ def test_book_valid_competition(client, booking_test_data): assert response.status_code == 200 assert b"How many places?" in response.data - def test_book_in_past_competition(client): response = client.get('/book/Spring%20Festival/Iron%20Temple', follow_redirects=True) @@ -90,6 +91,10 @@ def test_book_in_past_competition(client): assert response.status_code == 200 assert b"You cannot book places for a past competition" in response.data + + + + def test_club_points_are_deducted_after_booking(client, booking_test_data): club_test, competition_test = booking_test_data @@ -104,4 +109,22 @@ def test_club_points_are_deducted_after_booking(client, booking_test_data): assert response.status_code == 200 assert b"Great-booking complete!" in response.data - assert club_test["points"] == points_before - places_required \ No newline at end of file + assert club_test["points"] == points_before - places_required + + + + + +def test_display_list_of_club_and_their_current_point(client, booking_test_data): + club_test, competition_test = booking_test_data + + points_club = int(club_test["points"]) + name_club = club_test["name"] + + response = client.post('/showSummary',data= + {"email": "admin@irontemple.com"}) + + assert response.status_code == 200 + assert name_club.encode() in response.data + assert str(points_club).encode() in response.data + \ No newline at end of file