From a11bd003aa29106041e84289f2977b4f96ee2bc6 Mon Sep 17 00:00:00 2001 From: Raymond Penners Date: Fri, 3 Nov 2023 16:18:33 +0100 Subject: [PATCH] tests(amazon_cognito): Test utils --- .../providers/amazon_cognito/tests.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/allauth/socialaccount/providers/amazon_cognito/tests.py b/allauth/socialaccount/providers/amazon_cognito/tests.py index 04e42ad655..1c2b40c48b 100644 --- a/allauth/socialaccount/providers/amazon_cognito/tests.py +++ b/allauth/socialaccount/providers/amazon_cognito/tests.py @@ -2,11 +2,16 @@ from django.test import override_settings +import pytest + from allauth.account.models import EmailAddress from allauth.socialaccount.models import SocialAccount from allauth.socialaccount.providers.amazon_cognito.provider import ( AmazonCognitoProvider, ) +from allauth.socialaccount.providers.amazon_cognito.utils import ( + convert_to_python_bool_if_value_is_json_string_bool, +) from allauth.socialaccount.providers.amazon_cognito.views import ( AmazonCognitoOAuth2Adapter, ) @@ -67,3 +72,16 @@ def test_saves_email_as_verified_if_email_is_verified_in_cognito( def test_provider_slug_replaces_underscores_with_hyphens(self): self.assertTrue("_" not in self.provider.get_slug()) + + +@pytest.mark.parametrize( + "input,output", + [ + (True, True), + ("true", True), + ("false", False), + (False, False), + ], +) +def test_convert_bool(input, output): + assert convert_to_python_bool_if_value_is_json_string_bool(input) == output