def test_get_simplejwt_without_otp(active_user): response = login(active_user, path='/simplejwt-auth/login/') assert response.status_code == 200 assert get_username_from_jwt(response, 'access') == getattr( active_user, User.USERNAME_FIELD, )
def test_get_jwt_without_otp(active_user): response = login(active_user) assert response.status_code == 200 assert get_username_from_jwt(response) == getattr( active_user, User.USERNAME_FIELD, )
def test_ephemeral_token_verification_simple_jwt(active_user_with_email_otp): client = APIClient() first_step = login(active_user_with_email_otp) secret = active_user_with_email_otp.mfa_methods.first().secret response = client.post( path='/simplejwt-auth/login/code/', data={ 'token': first_step.data.get('ephemeral_token'), 'code': create_otp_code(secret), }, format='json', ) assert response.status_code == 200 assert get_username_from_jwt(response, 'access') == getattr( active_user_with_email_otp, User.USERNAME_FIELD, )