test on 12, but error and fails

This commit is contained in:
2025-07-03 15:08:11 +02:00
parent f323cd8310
commit 524c4ca028
6 changed files with 88 additions and 3 deletions

29
tests/test_purchase.py Normal file
View File

@@ -0,0 +1,29 @@
from bs4 import BeautifulSoup
from flask import session
class TestPoints:
def test_should_nok_when_too_much_points(self, client, connect, club1):
points = int(connect.span.text)
club1.update({"places": points+1})
response = client.post('/purchasePlaces', data=club1)
soup = BeautifulSoup(response.data, "html.parser")
assert "You don't have enough points" == soup.li.text
def test_should_ok_when_enough_points(self, client, connect, club1):
points = int(connect.span.text)
club1.update({"places": points-1})
response = client.post('/purchasePlaces', data=club1)
soup = BeautifulSoup(response.data, "html.parser")
assert "Great-booking complete!" == soup.li.text
class TestPlaces:
def test_should_refuse_more_than_12(self, client, club1):
club1.update({"places": 13})
response = client.post('/puchasePlaces', data=club1)
print(response.data)
soup = BeautifulSoup(response.data, "html.parser")
assert "You can't book more than 12 places" == soup.li.text