Update test to handle redirect

This commit is contained in:
Adrià Casajús 2023-05-03 16:11:59 +02:00
parent e54af47c70
commit be70e49596
No known key found for this signature in database
GPG key ID: F0033226A5AFC9B9

View file

@ -5,7 +5,7 @@ from tests.utils import login
def test_use_coupon(flask_client):
login(flask_client)
user = login(flask_client)
code = random_string(10)
Coupon.create(code=code, nb_year=1, commit=True)
@ -14,5 +14,7 @@ def test_use_coupon(flask_client):
data={"code": code},
)
assert r.status_code == 200
assert Coupon.get_by(code=code).used
assert r.status_code == 302
coupon = Coupon.get_by(code=code)
assert coupon.used
assert coupon.used_by_user_id == user.id