From c4d36fc2c4db6ba7f6cb22e26808edadd32abcfb Mon Sep 17 00:00:00 2001 From: Luis Alvergue Date: Wed, 22 May 2024 19:16:20 +0000 Subject: [PATCH] refactor(oauth): update tests to handle integer claims --- tests/pytest/oauth/test_views.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/pytest/oauth/test_views.py b/tests/pytest/oauth/test_views.py index 0f7493fc02..3c322ff71d 100644 --- a/tests/pytest/oauth/test_views.py +++ b/tests/pytest/oauth/test_views.py @@ -99,14 +99,11 @@ def test_authorize_success(mocked_oauth_create_client, mocked_analytics_module, @pytest.mark.django_db @pytest.mark.usefixtures("mocked_analytics_module") -@pytest.mark.parametrize("flag", ["true", "True", "tRuE"]) -def test_authorize_success_with_claim_true( - mocked_session_verifier_auth_required, mocked_oauth_create_client, app_request, flag -): +def test_authorize_success_with_claim_true(mocked_session_verifier_auth_required, mocked_oauth_create_client, app_request): verifier = mocked_session_verifier_auth_required.return_value verifier.auth_provider.claim = "claim" mocked_oauth_client = mocked_oauth_create_client.return_value - mocked_oauth_client.authorize_access_token.return_value = {"id_token": "token", "userinfo": {"claim": flag}} + mocked_oauth_client.authorize_access_token.return_value = {"id_token": "token", "userinfo": {"claim": "1"}} result = authorize(app_request) @@ -118,14 +115,15 @@ def test_authorize_success_with_claim_true( @pytest.mark.django_db @pytest.mark.usefixtures("mocked_analytics_module") -@pytest.mark.parametrize("flag", ["false", "False", "fAlSe"]) def test_authorize_success_with_claim_false( - mocked_session_verifier_auth_required, mocked_oauth_create_client, app_request, flag + mocked_session_verifier_auth_required, + mocked_oauth_create_client, + app_request, ): verifier = mocked_session_verifier_auth_required.return_value verifier.auth_provider.claim = "claim" mocked_oauth_client = mocked_oauth_create_client.return_value - mocked_oauth_client.authorize_access_token.return_value = {"id_token": "token", "userinfo": {"claim": flag}} + mocked_oauth_client.authorize_access_token.return_value = {"id_token": "token", "userinfo": {"claim": "0"}} result = authorize(app_request)