Trying to get the Auth Types to work right.

Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
This commit is contained in:
Cliff Hill
2024-01-29 16:09:27 -05:00
parent e64e500561
commit 77bc5fbfb1
4 changed files with 10 additions and 9 deletions

View File

@@ -210,7 +210,7 @@ def test_cannot_create_user_with_sms_auth_and_no_mobile(
assert (
json_resp["message"]
== "Mobile number must be set if auth_type is set to sms_auth"
== "Mobile number must be set if auth_type is set to AuthType.SMS"
)
@@ -883,15 +883,15 @@ def test_activate_user_fails_if_already_active(admin_request, sample_user):
def test_update_user_auth_type(admin_request, sample_user):
assert sample_user.auth_type == "sms_auth"
assert sample_user.auth_type == AuthType.SMS
resp = admin_request.post(
"user.update_user_attribute",
user_id=sample_user.id,
_data={"auth_type": "email_auth"},
_data={"auth_type": AuthType.EMAIL},
)
assert resp["data"]["id"] == str(sample_user.id)
assert resp["data"]["auth_type"] == "email_auth"
assert resp["data"]["auth_type"] == AuthType.EMAIL
def test_can_set_email_auth_and_remove_mobile_at_same_time(admin_request, sample_user):
@@ -922,7 +922,7 @@ def test_cannot_remove_mobile_if_sms_auth(admin_request, sample_user):
assert (
json_resp["message"]
== "Mobile number must be set if auth_type is set to sms_auth"
== "Mobile number must be set if auth_type is set to AuthType.SMS"
)

View File

@@ -425,7 +425,7 @@ def test_reset_failed_login_count_returns_404_when_user_does_not_exist(client):
assert resp.status_code == 404
# we send sms_auth users and webauthn_auth users email code to validate their email access
# we send AuthType.SMS users and AuthType.WEBAUTHN users email code to validate their email access
@pytest.mark.parametrize("auth_type", AuthType)
@pytest.mark.parametrize(
"data, expected_auth_url",
@@ -514,7 +514,7 @@ def test_send_email_code_returns_404_for_bad_input_data(admin_request):
@freeze_time("2016-01-01T12:00:00")
# we send sms_auth and webauthn_auth users email code to validate their email access
# we send iAuthType.SMS and AuthType.WEBAUTHN users email code to validate their email access
@pytest.mark.parametrize("auth_type", AuthType)
def test_user_verify_email_code(admin_request, sample_user, auth_type):
sample_user.logged_in_at = datetime.utcnow() - timedelta(days=1)