|
2 | 2 | from server import loadCompetitions, loadClubs
|
3 | 3 |
|
4 | 4 |
|
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) |
8 | 12 | places_to_purchase = 8
|
9 | 13 |
|
10 | 14 | 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'], |
13 | 17 | 'places': places_to_purchase
|
14 | 18 | })
|
15 | 19 |
|
@@ -47,7 +51,7 @@ def test_has_sufficient_points(client):
|
47 | 51 | assert b'Insufficiant points.' in response.data
|
48 | 52 |
|
49 | 53 |
|
50 |
| -def test_purchase_places(client, test_clubs, test_competitions, mocker): |
| 54 | +def test_update_points_after_purchase(client, test_clubs, test_competitions, mocker): |
51 | 55 |
|
52 | 56 | mocker.patch('server.loadClubs', return_value=test_clubs)
|
53 | 57 | mocker.patch('server.loadCompetitions', return_value=test_competitions)
|
|
0 commit comments