made test more simple
This commit is contained in:
@@ -4,38 +4,43 @@ from flask import session
|
|||||||
|
|
||||||
class TestPoints:
|
class TestPoints:
|
||||||
|
|
||||||
def test_should_nok_when_too_much_points(self, client, connect, club1):
|
def test_should_nok_when_too_much_points(self, client, connect, club2):
|
||||||
points = int(connect.span.text)
|
points = int(connect.span.text)
|
||||||
club1.update({"places": points+1})
|
club2.update({"places": points+1})
|
||||||
response = client.post('/purchasePlaces', data=club1)
|
response = client.post('/purchasePlaces', data=club2)
|
||||||
soup = BeautifulSoup(response.data, "html.parser")
|
soup = BeautifulSoup(response.data, "html.parser")
|
||||||
assert "You don't have enough points" == soup.li.text
|
assert "You don't have enough points" == soup.li.text
|
||||||
|
|
||||||
def test_should_ok_when_enough_points(self, client, connect, club1):
|
def test_should_ok_when_enough_points(self, client, connect, club2):
|
||||||
points = int(connect.span.text)
|
points = int(connect.span.text)
|
||||||
club1.update({"places": points-1})
|
# One remaining point after that :
|
||||||
response = client.post('/purchasePlaces', data=club1)
|
club2.update({"places": points-1})
|
||||||
|
response = client.post('/purchasePlaces', data=club2)
|
||||||
soup = BeautifulSoup(response.data, "html.parser")
|
soup = BeautifulSoup(response.data, "html.parser")
|
||||||
assert f"Great ! "+str(points-1)+" places booked for "+club1['competition'] == soup.li.text
|
assert f"Great ! "+str(points-1)+" places booked for "+club2['competition'] == soup.li.text
|
||||||
|
|
||||||
|
def test_book_more_than_one_should_be_refused(self, client, connect, club2):
|
||||||
|
points = int(connect.span.text)
|
||||||
|
assert int(points) == 1
|
||||||
|
|
||||||
|
|
||||||
class TestPlaces:
|
class TestPlaces:
|
||||||
|
|
||||||
def test_should_refuse_more_12_once(self, client, club1):
|
def test_should_refuse_more_12_once(self, client, club2):
|
||||||
club1.update({"places": 13})
|
club2.update({"places": 13})
|
||||||
response = client.post('/purchasePlaces', data=club1)
|
response = client.post('/purchasePlaces', data=club2)
|
||||||
soup = BeautifulSoup(response.data, "html.parser")
|
soup = BeautifulSoup(response.data, "html.parser")
|
||||||
assert "You can't book more than 12 places" == soup.li.text
|
assert "You can't book more than 12 places" == soup.li.text
|
||||||
|
|
||||||
def test_should_refuse_more_12_total(self, client, club1):
|
def test_should_refuse_more_12_total(self, client, club2):
|
||||||
club1.update({"places": 2})
|
club2.update({"places": 1})
|
||||||
response = client.post('/purchasePlaces', data=club1)
|
response = client.post('/purchasePlaces', data=club2)
|
||||||
soup = BeautifulSoup(response.data, "html.parser")
|
soup = BeautifulSoup(response.data, "html.parser")
|
||||||
assert "Great ! 2 places booked for "+club1['competition'] == soup.li.text
|
assert "Great ! 1 places booked for "+club2['competition'] == soup.li.text
|
||||||
club1.update({"places": 12})
|
club2.update({"places": 12})
|
||||||
response = client.post('/purchasePlaces', data=club1)
|
response = client.post('/purchasePlaces', data=club2)
|
||||||
soup = BeautifulSoup(response.data, "html.parser")
|
soup = BeautifulSoup(response.data, "html.parser")
|
||||||
assert "You already booked 12 places for "+club1['competition'] == soup.li.text
|
assert "You already booked 12 places for "+club2['competition'] == soup.li.text
|
||||||
|
|
||||||
|
|
||||||
class TestDate:
|
class TestDate:
|
||||||
|
|||||||
Reference in New Issue
Block a user