Skip to content

Commit 4f7fa8a

Browse files
Update test_server.py
1 parent 17287a6 commit 4f7fa8a

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

tests/test_server.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
from server import loadCompetitions, loadClubs
33

44

5-
def test_purchase_places(client):
6-
test_club = loadClubs()[0]
7-
test_competition = loadCompetitions()[0]
5+
def test_purchase_places(client, test_clubs, test_competitions, mocker):
6+
mocker.patch('server.loadClubs', return_value=test_clubs)
7+
mocker.patch('server.loadCompetitions', return_value=test_competitions)
8+
mock_save_club = mocker.patch('server.saveClub')
9+
10+
mocker.patch.object(server, 'clubs', test_clubs)
11+
mocker.patch.object(server, 'competitions', test_competitions)
812
places_to_purchase = 8
913

1014
response = client.post('/purchasePlaces', data={
11-
'club': test_club['name'],
12-
'competition': test_competition['name'],
15+
'club': test_clubs[0]['name'],
16+
'competition': test_competitions[0]['name'],
1317
'places': places_to_purchase
1418
})
1519

@@ -47,7 +51,7 @@ def test_has_sufficient_points(client):
4751
assert b'Insufficiant points.' in response.data
4852

4953

50-
def test_purchase_places(client, test_clubs, test_competitions, mocker):
54+
def test_update_points_after_purchase(client, test_clubs, test_competitions, mocker):
5155

5256
mocker.patch('server.loadClubs', return_value=test_clubs)
5357
mocker.patch('server.loadCompetitions', return_value=test_competitions)

0 commit comments

Comments
 (0)