use null instead of "" in /api/auth/login

This commit is contained in:
Son NK 2020-02-04 18:32:57 +07:00
parent 3483faa34a
commit c7903d534a
2 changed files with 4 additions and 4 deletions

View File

@ -54,11 +54,11 @@ def auth_login():
if user.enable_otp:
s = Signer(FLASK_SECRET)
ret["mfa_key"] = s.sign(str(user.id))
ret["api_key"] = ""
ret["api_key"] = None
else:
api_key = ApiKey.create(user.id, device)
db.session.commit()
ret["mfa_key"] = ""
ret["mfa_key"] = None
ret["api_key"] = api_key.code
return jsonify(**ret), 200

View File

@ -16,7 +16,7 @@ def test_auth_login_success_mfa_disabled(flask_client):
assert r.status_code == 200
assert r.json["api_key"]
assert r.json["mfa_enabled"] == False
assert r.json["mfa_key"] == ""
assert r.json["mfa_key"] is None
assert r.json["name"] == "Test User"
@ -36,7 +36,7 @@ def test_auth_login_success_mfa_enabled(flask_client):
)
assert r.status_code == 200
assert r.json["api_key"] == ""
assert r.json["api_key"] is None
assert r.json["mfa_enabled"] == True
assert r.json["mfa_key"]
assert r.json["name"] == "Test User"