33
44def test_purchase_places (client ):
55
6- clubs = loadClubs ()
7- competitions = loadCompetitions ()
8-
9- test_club = clubs [0 ]
10- test_competition = competitions [0 ]
6+ test_club = loadClubs ()[0 ]
7+ test_competition = loadCompetitions ()[0 ]
118 places_to_purchase = 8
129
1310 response = client .post ('/purchasePlaces' , data = {
@@ -22,11 +19,8 @@ def test_purchase_places(client):
2219
2320def test_max_purchase_places (client ):
2421
25- clubs = loadClubs ()
26- competitions = loadCompetitions ()
27-
28- test_club = clubs [0 ]
29- test_competition = competitions [0 ]
22+ test_club = loadClubs ()[0 ]
23+ test_competition = loadCompetitions ()[0 ]
3024 places_to_purchase = 28
3125
3226 response = client .post ('/purchasePlaces' , data = {
@@ -37,3 +31,19 @@ def test_max_purchase_places(client):
3731
3832 assert response .status_code == 200
3933 assert b'Max purchase 12.' in response .data
34+
35+
36+ def test_has_sufficient_points (client ):
37+
38+ test_club = loadClubs ()[1 ]
39+ test_competition = loadCompetitions ()[0 ]
40+ places_to_purchase = 9
41+
42+ response = client .post ('/purchasePlaces' , data = {
43+ 'club' : test_club ['name' ],
44+ 'competition' : test_competition ['name' ],
45+ 'places' : places_to_purchase
46+ })
47+
48+ assert response .status_code == 200
49+ assert b'Insufficiant points.' in response .data
0 commit comments