Skip to content

Fixed update points chlub after purchase #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
})

Expand Down Expand Up @@ -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)
Expand Down