
    g	                         d dl m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 ej                  j                  dd	d
dgfd
d
ddgfd
d	dgfg      d        Zd Zy)    )ANY)reverseN)assertTemplateUsed)app_settings)get_adapter)"AUTHENTICATION_METHODS_SESSION_KEYz0with_totp,with_password,expected_method_urlnamesFTaccount_reauthenticatemfa_reauthenticatec                 D   t         j                  s|ry  | ||rd nd      }|j                         |k(  sJ |j                  |       t	               j                  |      }t        |      t        |      k(  sJ t        |D cg c]  }|d   	 c}      t        t        t        |            k(  sJ dD ]e  }|dk(  rt         j                  s|j                  t        |      dz         }	||v r|	j                  dk(  rJJ |	j                  dk(  sJ d	|	d
   v reJ  y c c}w )N!)	with_totppasswordurl)r	   r
   r
   z
?next=/foo   .  znext=%2Ffoolocation)allauth_settingsMFA_ENABLEDhas_usable_passwordforce_loginr   get_reauthentication_methodslensetmapr   getstatus_code)
user_factoryr   with_passwordexpected_method_urlnamesclientusermethodsmurlnameresps
             h/var/www/django_project/virt/lib/python3.12/site-packages/allauth/account/tests/test_reauthentication.pytest_user_with_mfa_onlyr'      s2    ''I)mdQTUD##%666
tm88>Gw<378888'*Q%*+sG-.0    D 5**3C3O3Ozz''*\9:..##s***##s*** D$44445 +s   Dc                    d| _         |j                  t        d      ddd      }|d   j                  t        d            sJ |j	                  t        d            }t        |d       |j                  t        d      d	|i
      }|j                  dk(  sJ |j                  t        d      ddd      }|d   j                  t        d            sJ |j                  t           }|d   d	t        ddk(  sJ y )NTaccount_email zjohn3@example.org)
action_addemailr   r	   zaccount/reauthenticate.htmlr   )datar   )methodatreauthenticated)
!ACCOUNT_REAUTHENTICATION_REQUIREDpostr   
startswithr   r   r   sessionr   r   )settingsauth_clientuser_passwordr%   r"   s        r&   test_reauthenticationr9   -   s   15H. $78D 
&&w/G'HIII??7#;<=Dt:;()]0K  D s""" $78D 
&&w'?@@@!!"DEG2;ZstTTTT    )unittest.mockr   django.urlsr   pytestpytest_django.assertsr   allauthr   r   allauth.account.adapterr   allauth.account.authenticationr   markparametrizer'   r9    r:   r&   <module>rE      sx       4 4 / M 6	/01	t.0DEF	u+,-550Ur:   