o
    Lf                     @   s   d dl Z d dlmZ d dlmZ d dlZd dlmZ d dlm	Z	 ej
di dfdd	id
fddid
fgdd Zdd Zdd Zdd ZdS )    N)settings)reverse)assertRedirects)app_settingszheaders,ajax_expectedFHTTP_X_REQUESTED_WITHXMLHttpRequestTHTTP_ACCEPTapplication/jsonc                 C   s   |j tdddddddfi |}|r3|jdksJ | d tjks&J | d tjks1J d S |jdks:J t|tjdd	 d S )
Naccount_signupjohndoezjohn@example.org)usernameemailemail2	password1	password2   locationi.  F)fetch_redirect_response)postr   status_codejsonr   LOGIN_REDIRECT_URLr   )dbclientheadersajax_expectedresp r   `/var/www/html/humari/django-venv/lib/python3.10/site-packages/allauth/account/tests/test_ajax.pytest_ajax_headers   s&   		
r   c                 C   sT   | j tdd|jidd}t|dksJ |d j|jgks J |d dks(J d S )	Naccount_reset_passwordr   r   )datar      r   zcontent-typer	   )r   r   r   lento)r   user
mailoutboxr   r   r   r   test_ajax_password_reset+   s   r'   c                 C   s8   | j tdi dd}|jdksJ t|jd d S )Naccount_loginr   r   i  utf8)r   r   r   r   loadscontentdecode)r   r   r   r   r   r   test_ajax_login_fail6   s   r.   c                 C   sZ   t jj| _|jtd|j|ddd}|jdksJ t	|j
d}|d dks+J d S )	Nr(   )loginpasswordr   r)   r   r*   r   z/accounts/profile/)r   EmailVerificationMethodOPTIONALACCOUNT_EMAIL_VERIFICATIONr   r   r   r   r   r+   r,   r-   )r   r%   user_passwordr   r   r!   r   r   r   test_ajax_login_successA   s   

r5   )r   django.confr   django.urlsr   pytestpytest_django.assertsr   allauth.accountr   markparametrizer   r'   r.   r5   r   r   r   r   <module>   s"    


