mirror of
https://github.com/simple-login/app.git
synced 2024-11-16 00:48:32 +01:00
Update test to handle redirect
This commit is contained in:
parent
e54af47c70
commit
be70e49596
1 changed files with 5 additions and 3 deletions
|
@ -5,7 +5,7 @@ from tests.utils import login
|
||||||
|
|
||||||
|
|
||||||
def test_use_coupon(flask_client):
|
def test_use_coupon(flask_client):
|
||||||
login(flask_client)
|
user = login(flask_client)
|
||||||
code = random_string(10)
|
code = random_string(10)
|
||||||
Coupon.create(code=code, nb_year=1, commit=True)
|
Coupon.create(code=code, nb_year=1, commit=True)
|
||||||
|
|
||||||
|
@ -14,5 +14,7 @@ def test_use_coupon(flask_client):
|
||||||
data={"code": code},
|
data={"code": code},
|
||||||
)
|
)
|
||||||
|
|
||||||
assert r.status_code == 200
|
assert r.status_code == 302
|
||||||
assert Coupon.get_by(code=code).used
|
coupon = Coupon.get_by(code=code)
|
||||||
|
assert coupon.used
|
||||||
|
assert coupon.used_by_user_id == user.id
|
||||||
|
|
Loading…
Reference in a new issue