
    f
                         d dl Z d dlmZ d dlZd dlmZ d dlmZ d dlm	Z	 d dl
mZ d dlmZ d dlmZ d d	lmZmZ d
 Z edddii       G d dee             Zej*                  j-                  dg d      d        Zy)    N)override_settings)EmailAddress)SocialAccount)AmazonCognitoProvider3convert_to_python_bool_if_value_is_json_string_bool)AmazonCognitoOAuth2Adapter)OAuth2TestsMixin)MockedResponseTestCasec                      ddddddS )Nz$4993b410-8a1b-4c36-b843-a9c1a697e6b7JohnDoezjdoe@example.comjohndoe)sub
given_namefamily_nameemailusername r       o/var/www/cs2snipe.com/venv/lib/python3.12/site-packages/allauth/socialaccount/providers/amazon_cognito/tests.py_get_mocked_claimsr      s    5# r   amazon_cognitoDOMAINz/https://domain.auth.us-east-1.amazoncognito.comSOCIALACCOUNT_PROVIDERSc                   ^    e Zd Zej                  Zd Zd Z edi i      d        Z	d Z
d Zy)	AmazonCognitoTestCasec                 V    t        j                  t                     }t        d|      S )N   status_codecontent)jsondumpsr   r   )selfmocked_payloads     r   get_mocked_responsez)AmazonCognitoTestCase.get_mocked_response(   s!    $6$89#~FFr   c                      y)Nr   r   r'   s    r   get_expected_to_strz)AmazonCognitoTestCase.get_expected_to_str,   s    r   r   r   c                     | j                         }| j                  t        t        j                        5  | j                  |       d d d        y # 1 sw Y   y xY w)N)msg)r)   assertRaises
ValueErrorr	   DOMAIN_KEY_MISSING_ERRORlogin)r'   mocked_responses     r   8test_oauth2_adapter_raises_if_domain_settings_is_missingzNAmazonCognitoTestCase.test_oauth2_adapter_raises_if_domain_settings_is_missing/   sT     224*CC  
 	( JJ'		( 	( 	(s   AAc                    t               }d|d<   t        j                  |      }t        d|      }| j	                  |       t
        j                  j                  |d         j                  }t        j                  j                  |      }| j                  |j                  |d          | j                  |j                         y )	NTemail_verifiedr!   r"   r   )uid)user_idr   )r   r%   r&   r   r2   r   objectsgetr8   r   assertEqualr   
assertTrueverified)r'   mocked_claimsr(   r3   r8   email_addresss         r   <test_saves_email_as_verified_if_email_is_verified_in_cognitozRAmazonCognitoTestCase.test_saves_email_as_verified_if_email_is_verified_in_cognito;   s     +,*.&'M2(S.Q

?#''++e0D+EMM$,,000A,,mG.DE../r   c                 Z    | j                  d| j                  j                         v       y )N_)r<   providerget_slugr+   s    r   4test_provider_slug_replaces_underscores_with_hyphenszJAmazonCognitoTestCase.test_provider_slug_replaces_underscores_with_hyphensK   s     4==#9#9#;;<r   N)__name__
__module____qualname__r   idprovider_idr)   r,   r   r4   r@   rE   r   r   r   r   r       sD     (**KG 0@"/EF	( G	(0 =r   r   zinput,output))TT)trueT)falseF)FFc                 $    t        |       |k(  sJ y )Nr   )inputoutputs     r   test_convert_boolrP   O   s     ?uEOOOr   )r%   django.testr   pytestallauth.account.modelsr   allauth.socialaccount.modelsr   7allauth.socialaccount.providers.amazon_cognito.providerr   4allauth.socialaccount.providers.amazon_cognito.utilsr   4allauth.socialaccount.providers.amazon_cognito.viewsr	   allauth.socialaccount.testsr
   allauth.testsr   r   r   r   markparametrizerP   r   r   r   <module>r\      s     )  / 6 9 2 8%VW
'=,h '=
'=T PPr   