diff --git a/server.py b/server.py index f3c87274b..beb3dc49d 100644 --- a/server.py +++ b/server.py @@ -28,8 +28,9 @@ def index(): @app.route('/showSummary',methods=['POST']) def showSummary(): club = [club for club in clubs if club['email'] == request.form['email']] + other_clubs = [club for club in clubs if club['email'] != request.form['email']] if len(club): - return render_template('welcome.html',club=club[0],competitions=competitions), 200 + return render_template('welcome.html',club=club[0],competitions=competitions, clubs=other_clubs), 200 return render_template('index.html'), 401 diff --git a/templates/welcome.html b/templates/welcome.html index ff6b261a2..602e78a23 100644 --- a/templates/welcome.html +++ b/templates/welcome.html @@ -30,6 +30,17 @@

Competitions:


{% endfor %} +

Clubs:

+ {%endwith%} diff --git a/tests/unit_test/conftest.py b/tests/unit_test/conftest.py index 468cc2a6f..2064f2b1f 100644 --- a/tests/unit_test/conftest.py +++ b/tests/unit_test/conftest.py @@ -5,8 +5,13 @@ clubs_obj = [ { - "name":"TEST_CLUB", - "email":"TEST_CLUB_EMAIL", + "name":"TEST_CLUB_1", + "email":"TEST_CLUB_EMAIL_1", + "points":"10" + }, + { + "name":"TEST_CLUB_2", + "email":"TEST_CLUB_EMAIL_2", "points":"10" } ] diff --git a/tests/unit_test/mocks_files/fixture_load.json b/tests/unit_test/mocks_files/fixture_load.json index d915ac3d6..f35b61191 100644 --- a/tests/unit_test/mocks_files/fixture_load.json +++ b/tests/unit_test/mocks_files/fixture_load.json @@ -1,9 +1,14 @@ { "clubs":[ { - "name":"TEST_CLUB", - "email":"TEST_CLUB_EMAIL", + "name":"TEST_CLUB_1", + "email":"TEST_CLUB_EMAIL_1", "points":"9" + }, + { + "name":"TEST_CLUB_2", + "email":"TEST_CLUB_EMAIL_2", + "points":"10" } ], "competitions": [ diff --git a/tests/unit_test/test_server.py b/tests/unit_test/test_server.py index 05d55f326..ab7c13a78 100644 --- a/tests/unit_test/test_server.py +++ b/tests/unit_test/test_server.py @@ -40,7 +40,7 @@ def test_sould_not_purshase_more_than_I_own(self): def test_sould_not_purshase_more_than_12_places(self): response = self.client.post('/purchasePlaces', data={ - "club": "TEST_CLUB", + "club": "TEST_CLUB_2", "competition": "TEST_COMPETITION_2", "places": 13 }) @@ -49,7 +49,7 @@ def test_sould_not_purshase_more_than_12_places(self): def test_sould_not_purshase_booking_if_date_passed(self): response = self.client.post('/purchasePlaces', data={ - "club": "TEST_CLUB", + "club": "TEST_CLUB_1", "competition": "TEST_COMPETITION_1", "places": 1 }) @@ -69,3 +69,12 @@ def test_club_points_should_be_reflected_after_booking(self): }) self.assertEqual(int(club.get('points')), points - places) self.assertEqual(int(competition.get('numberOfPlaces')), number_of_places - places) + + def test_feature_implementation(self): + response = self.client.post("/showSummary", data={'email': self.clubs[0].get('email')}) + for i, club in enumerate(self.clubs): + if i != 0: + self.assertIn(club.get("name"), response.data.decode()) + self.assertIn(f"Points: {club.get('points')}
", response.data.decode()) + self.assertIn(f"Email: {club.get('email')}", response.data.decode()) + assert response.status_code == 200