
    g                         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                  j                  di dfdd	id
fddid
fg      d        Zd Zd Zd Zy)    N)settings)reverse)assertRedirects)app_settingszheaders,ajax_expectedFHTTP_X_REQUESTED_WITHXMLHttpRequestTHTTP_ACCEPTapplication/jsonc           	      d    |j                   t        d      ddddddfi |}|r^|j                  dk(  sJ |j                         d   t        j
                  k(  sJ |j                         d   t        j
                  k(  sJ y |j                  dk(  sJ t        |t        j
                  d	       y )
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resps        \/var/www/django_project/virt/lib/python3.12/site-packages/allauth/account/tests/test_ajax.pytest_ajax_headersr       s     6;; !!'(""	

 
D 3&&&yy{:&(*E*EEEEyy{:&(*E*EEEE3&&&(--u	
    c                     | j                  t        d      d|j                  id      }t        |      dk(  sJ |d   j                  |j                  gk(  sJ |d   dk(  sJ y )	Naccount_reset_passwordr   r   )datar      r   zcontent-typer
   )r   r   r   lento)r   user
mailoutboxr   s       r   test_ajax_password_resetr*   +   ss    ;;()tzz".  D
 z?aa=

|+++#5555r!   c                     | j                  t        d      i d      }|j                  dk(  sJ t        j                  |j
                  j                  d             y )Naccount_loginr   r   i  utf8)r   r   r   r   loadscontentdecode)r   r   r   s      r   test_ajax_login_failr2   6   sT    ;; 
.  D
 s"""JJt||""6*+r!   c                 (   t         j                  j                  | _        |j	                  t        d      |j                  |dd      }|j                  dk(  sJ t        j                  |j                  j                  d            }|d   dk(  sJ y )	Nr,   )loginpasswordr   r-   r   r.   r   z/accounts/profile/)r   EmailVerificationMethodOPTIONALACCOUNT_EMAIL_VERIFICATIONr   r   r   r   r   r/   r0   r1   )r   r(   user_passwordr   r   r$   s         r   test_ajax_login_successr:   A   s    *6*N*N*W*WH';; --];.  D
 s"""::dll))&12D
3333r!   )r   django.confr   django.urlsr   pytestpytest_django.assertsr   allauth.accountr   markparametrizer    r*   r2   r:    r!   r   <module>rC      st         1 ( 	U
!#3	4d;
+	,d3

.6,	4r!   