o
    Lfj
                     @   s   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
d ZedddiidG dd deeZejdg ddd ZdS )    N)override_settings)EmailAddress)SocialAccount)AmazonCognitoProvider3convert_to_python_bool_if_value_is_json_string_bool)AmazonCognitoOAuth2Adapter)OAuth2TestsMixin)MockedResponseTestCasec                   C   s   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   r   r   u/var/www/html/humari/django-venv/lib/python3.10/site-packages/allauth/socialaccount/providers/amazon_cognito/tests.py_get_mocked_claims   s   r   amazon_cognitoDOMAINz/https://domain.auth.us-east-1.amazoncognito.comSOCIALACCOUNT_PROVIDERSc                   @   s@   e Zd ZejZdd Zedi iddd Zdd Z	d	d
 Z
dS )AmazonCognitoTestCasec                 C   s   t t }td|dS )N   status_codecontent)jsondumpsr   r
   )selfmocked_payloadr   r   r   get_mocked_response(   s   z)AmazonCognitoTestCase.get_mocked_responser   r   c                 C   sH   |   }| jttjd | | W d    d S 1 sw   Y  d S )N)msg)r$   assertRaises
ValueErrorr   DOMAIN_KEY_MISSING_ERRORlogin)r"   mocked_responser   r   r   8test_oauth2_adapter_raises_if_domain_settings_is_missing-   s   "zNAmazonCognitoTestCase.test_oauth2_adapter_raises_if_domain_settings_is_missingc                 C   sr   t  }d|d< t|}td|d}| | tjj|d dj}t	jj|d}| 
|j|d  | |j d S )	NTemail_verifiedr   r   r   )uid)user_idr   )r   r    r!   r
   r)   r   objectsgetr.   r   assertEqualr   
assertTrueverified)r"   mocked_claimsr#   r*   r.   email_addressr   r   r   <test_saves_email_as_verified_if_email_is_verified_in_cognito9   s   

zRAmazonCognitoTestCase.test_saves_email_as_verified_if_email_is_verified_in_cognitoc                 C   s   |  d| j v d S )N_)r2   providerget_slug)r"   r   r   r   4test_provider_slug_replaces_underscores_with_hyphensI   s   zJAmazonCognitoTestCase.test_provider_slug_replaces_underscores_with_hyphensN)__name__
__module____qualname__r   idprovider_idr$   r   r+   r6   r:   r   r   r   r   r       s    
r   zinput,output))TT)trueT)falseF)FFc                 C   s   t | |ksJ d S )Nr   )inputoutputr   r   r   test_convert_boolM   s   
rD   )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parametrizerD   r   r   r   r   <module>   s*    
(	