added ok and nok on points

This commit is contained in:
2025-07-03 11:41:17 +02:00
parent 813b7849fe
commit 0370de60e0
5 changed files with 31 additions and 14 deletions

View File

@@ -2,10 +2,18 @@ from bs4 import BeautifulSoup
from flask import session
def test_should_not_when_try_more_points_than_available(client):
data = {"competition": "Spring Festival", "club": "Iron Temple", "places": "6"}
response = client.post('/purchasePlaces', data=data)
soup = BeautifulSoup(response.data, "html.parser")
print(soup.li.text)
assert "You don't have enough points" == soup.li.text
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)
data = club1.update({"places": points-1})
response = client.post('/purchasePlaces', data=club1)
soup = BeautifulSoup(response.data, "html.parser")
assert "Great-booking complete!" == soup.li.text