replace get(1) by first()
This commit is contained in:
parent
2f8f354f28
commit
012c6fc3fb
2
shell.py
2
shell.py
|
@ -140,7 +140,7 @@ app = create_app()
|
|||
with app.app_context():
|
||||
# to test email template
|
||||
# with open("/tmp/email.html", "w") as f:
|
||||
# user = User.get(1)
|
||||
# user = User.first()
|
||||
# f.write(
|
||||
# render(
|
||||
# "transactional/reset-password.html",
|
||||
|
|
|
@ -79,7 +79,7 @@ def test_auth_login_device_exist(flask_client):
|
|||
|
||||
|
||||
def test_auth_register_success(flask_client):
|
||||
assert AccountActivation.get(1) is None
|
||||
assert AccountActivation.first() is None
|
||||
|
||||
r = flask_client.post(
|
||||
url_for("api.auth_register"),
|
||||
|
@ -90,7 +90,7 @@ def test_auth_register_success(flask_client):
|
|||
assert r.json["msg"]
|
||||
|
||||
# make sure an activation code is created
|
||||
act_code = AccountActivation.get(1)
|
||||
act_code = AccountActivation.first()
|
||||
assert act_code
|
||||
assert len(act_code.code) == 6
|
||||
assert act_code.tries == 3
|
||||
|
@ -116,7 +116,7 @@ def test_auth_activate_success(flask_client):
|
|||
assert r.json["msg"]
|
||||
|
||||
# get the activation code
|
||||
act_code = AccountActivation.get(1)
|
||||
act_code = AccountActivation.first()
|
||||
assert act_code
|
||||
assert len(act_code.code) == 6
|
||||
|
||||
|
@ -156,7 +156,7 @@ def test_auth_activate_wrong_code(flask_client):
|
|||
assert r.json["msg"]
|
||||
|
||||
# get the activation code
|
||||
act_code = AccountActivation.get(1)
|
||||
act_code = AccountActivation.first()
|
||||
assert act_code
|
||||
assert len(act_code.code) == 6
|
||||
assert act_code.tries == 3
|
||||
|
@ -171,7 +171,7 @@ def test_auth_activate_wrong_code(flask_client):
|
|||
assert r.status_code == 400
|
||||
|
||||
# make sure the nb tries decrements
|
||||
act_code = AccountActivation.get(1)
|
||||
act_code = AccountActivation.first()
|
||||
assert act_code.tries == 2
|
||||
|
||||
|
||||
|
@ -185,7 +185,7 @@ def test_auth_activate_too_many_wrong_code(flask_client):
|
|||
assert r.json["msg"]
|
||||
|
||||
# get the activation code
|
||||
act_code = AccountActivation.get(1)
|
||||
act_code = AccountActivation.first()
|
||||
assert act_code
|
||||
assert len(act_code.code) == 6
|
||||
assert act_code.tries == 3
|
||||
|
@ -209,7 +209,7 @@ def test_auth_activate_too_many_wrong_code(flask_client):
|
|||
assert r.status_code == 410
|
||||
|
||||
# make sure the nb tries decrements
|
||||
assert AccountActivation.get(1) is None
|
||||
assert AccountActivation.first() is None
|
||||
|
||||
|
||||
def test_auth_reactivate_success(flask_client):
|
||||
|
@ -222,7 +222,7 @@ def test_auth_reactivate_success(flask_client):
|
|||
assert r.status_code == 200
|
||||
|
||||
# make sure an activation code is created
|
||||
act_code = AccountActivation.get(1)
|
||||
act_code = AccountActivation.first()
|
||||
assert act_code
|
||||
assert len(act_code.code) == 6
|
||||
assert act_code.tries == 3
|
||||
|
|
|
@ -61,5 +61,5 @@ def test_mark_notification_as_read(flask_client):
|
|||
)
|
||||
|
||||
assert r.status_code == 200
|
||||
notification = Notification.get(1)
|
||||
notification = Notification.first()
|
||||
assert notification.read
|
||||
|
|
Loading…
Reference in New Issue