Linting and fix unit tests

This commit is contained in:
zandercymatics 2024-05-16 14:15:42 -06:00
parent 733cc53f91
commit 7681cc4f0b
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
4 changed files with 65 additions and 68 deletions

View file

@ -96,7 +96,7 @@ def login_callback(request):
# if not satisfied, redirect user to login requiring biometric auth
# Tests for the presence of the vtm/vtr values in the userinfo object.
# If they are there, then we can set a flag in our session for tracking purposes.
# If they are there, then we can set a flag in our session for tracking purposes.
needs_biometric_validation = _requires_biometric_auth(userinfo)
request.session["needs_biometric_validation"] = needs_biometric_validation
@ -145,9 +145,22 @@ def login_callback(request):
return error_page(request, err)
def _requires_biometric_auth(userinfo):
"""if User.needs_identity_verification and step_up_acr_value not in
ial returned from callback, return True"""
def _requires_biometric_auth(userinfo) -> bool:
"""
Checks for the presence of the key 'vtm' and 'vtr' in the provided `userinfo` object.
If they are not found, then we call `User.needs_identity_verification()`.
Args:
userinfo (dict): A dictionary of data from the returned user object.
Return Conditions:
If the provided user does not exist in any tables which would preclude them from doing
biometric authentication, then we return True. Otherwise, we return False.
Alternatively, if 'vtm' and 'vtr' already exist on `userinfo`, then we return False.
"""
uuid = userinfo.get("sub", "")
email = userinfo.get("email", "")
if not userinfo.get("vtm") or not userinfo.get("vtr"):