diff --git a/tests/test_server.py b/tests/test_server.py index 07e3860c7..c54583258 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -2,14 +2,18 @@ from server import loadCompetitions, loadClubs -def test_purchase_places(client): - test_club = loadClubs()[0] - test_competition = loadCompetitions()[0] +def test_purchase_places(client, test_clubs, test_competitions, mocker): + mocker.patch('server.loadClubs', return_value=test_clubs) + mocker.patch('server.loadCompetitions', return_value=test_competitions) + mock_save_club = mocker.patch('server.saveClub') + + mocker.patch.object(server, 'clubs', test_clubs) + mocker.patch.object(server, 'competitions', test_competitions) places_to_purchase = 8 response = client.post('/purchasePlaces', data={ - 'club': test_club['name'], - 'competition': test_competition['name'], + 'club': test_clubs[0]['name'], + 'competition': test_competitions[0]['name'], 'places': places_to_purchase }) @@ -47,7 +51,7 @@ def test_has_sufficient_points(client): assert b'Insufficiant points.' in response.data -def test_purchase_places(client, test_clubs, test_competitions, mocker): +def test_update_points_after_purchase(client, test_clubs, test_competitions, mocker): mocker.patch('server.loadClubs', return_value=test_clubs) mocker.patch('server.loadCompetitions', return_value=test_competitions)