Ë
    rk,  ã                   ón   — d Z ddlmZ ddlmZ ddlmZmZ ddlm	Z	m
Z
 ddlmZ ddlmZ  G d„ d	e
«      Zy
)zJModule g_retour : portee des etats, bouton Retour du coin superieur droit.é    )Úget_user_model)ÚAnonymousUser)ÚContextÚTemplate)ÚRequestFactoryÚTestCase)Úreverse)ÚPointDeVentec                   óD   — e Zd Zd„ Zdd„Zd„ Zd„ Zd„ Zd„ Zd„ Z	d	„ Z
d
„ Zy)ÚGRetourTagsTestsc                 ó  — t         j                  j                  d¬«      | _        t         j                  j                  d¬«      | _        t        «       j                  j                  ddd| j                  ¬«      | _        y )NzPDV NAV)Únomz	PDV NAV 2znav.userznav.user@test.comÚsecret)ÚusernameÚemailÚpasswordÚpoint_de_vente)r
   ÚobjectsÚcreateÚpdvÚ	other_pdvr   Úcreate_userÚuser)Úselfs    ú]/home/exaucensingi/Documents/ProjectPython/GBM_FacControl/faccontrol_acokin/g_retour/tests.pyÚsetUpzGRetourTagsTests.setUp   si   € Ü×'Ñ'×.Ñ.°9Ð.Ó=ˆŒÜ%×-Ñ-×4Ñ4¸Ð4ÓEˆŒÜ"Ó$×,Ñ,×8Ñ8ØÐ':ÀXÐ^b×^fÑ^fð 9ó 
ˆ�	ó    Nc                 ój   — t        «       j                  d«      }||_        |�	||_        |S i |_        |S )Nz
/factures/)r   Úgetr   Úsession)r   r   r    Úrequests       r   Ú_requestzGRetourTagsTests._request   s<   € Ü Ó"×&Ñ& |Ó4ˆØˆŒØ%,Ð%8˜'ˆŒØˆð ?AˆŒØˆr   c                 óV   — t        d|z   «      j                  t        d|i|¥«      «      S )Nz{% load g_retour %}r!   )r   Úrenderr   )r   Útemplater!   Úextras       r   Ú_renderzGRetourTagsTests._render   s/   € ÜÐ-°Ñ8Ó9×@Ñ@ÄÈ)ÐU\ÐIfÐ`eÐIfÓAgÓhÐhr   c                 ód  — | j                  | j                  «      }| j                  d«      5  | j                  d|«      }d d d «       | j	                  d| j                  j
                  › d�«       | j	                  d| j                  j
                  › �|«       | j	                  dt        d«      › d�|«       | j                  d| j                  | j                  d	| j                  j
                  i«      «      }| j	                  d| j                  j
                  › �|«       y # 1 sw Y   ŒçxY w)
Nr   ú{% g_retour_body_attrs %}údata-nav-scope="uú|cz|pzdata-nav-home="úfacturation:dashboardú"Úactive_pos_id)	r"   r   ÚassertNumQueriesr'   ÚassertInÚpkr   r	   r   )r   r!   ÚattrsÚswitcheds       r   ÚAtest_scope_separates_user_company_and_point_of_sale_without_queryzRGRetourTagsTests.test_scope_separates_user_company_and_point_of_sale_without_query   sü   € Ø—-‘- §	¡	Ó*ˆØ×"Ñ" 1Ó%ñ 	GØ—L‘LÐ!<¸gÓFˆE÷	Gà�‰Ð)¨$¯)©)¯,©,¨°rÐ:¸EÔBØ�‰˜˜4Ÿ8™8Ÿ;™;˜-Ð(¨%Ô0Ø�‰˜¬Ð0GÓ(HÐ'IÈÐKÈUÔSð —<‘<Ð ;¸T¿]¹]È4Ï9É9ÐWfÐhl×hvÑhv×hyÑhyÐVzÓ={Ó|ˆØ�‰˜˜4Ÿ>™>×,Ñ,Ð-Ð.°Õ9÷	Gð 	Gús   ­D&Ä&D/c                 ó¾   — | j                  t        «       «      }| j                  | j                  d|«      d«       | j	                  d| j                  d|«      «       y )Nr)   Ú zdata-nav-backú{% g_retour_coin %})r"   r   ÚassertEqualr'   ÚassertNotIn©r   r!   s     r   Ú7test_anonymous_pages_have_no_scope_and_no_corner_buttonzHGRetourTagsTests.test_anonymous_pages_have_no_scope_and_no_corner_button)   sJ   € Ø—-‘-¤£Ó0ˆØ×Ñ˜Ÿ™Ð&AÀ7ÓKÈRÔPØ×Ñ˜¨$¯,©,Ð7LÈgÓ*VÕWr   c                 óü  — | j                  d| j                  | j                  «      d¬«      }| j                  d|«       | j                  d|«       | j                  d|«       | j                  d| j                  | j                  «      «      }| j                  d|«       | j	                  d|«       | j                  d	| j                  | j                  «      «      }| j                  d
t        d«      › d�|«       y )Nz{% g_retour_coin secours %}z/factures/?page=2)Úsecourszhref="/factures/?page=2"údata-g-retour-coinÚRetourz {% bouton_retour "/produits/" %}zhref="/produits/"r7   zhref="r,   r-   )r'   r"   r   r0   r9   r	   )r   ÚcornerÚpage_buttonÚhomes       r   ÚLtest_corner_button_and_page_button_link_to_their_fallback_without_javascriptz]GRetourTagsTests.test_corner_button_and_page_button_link_to_their_fallback_without_javascript.   sÎ   € Ø—‘Ð;¸T¿]¹]È4Ï9É9Ó=UÐ_r�ÓsˆØ�‰Ð0°&Ô9Ø�‰Ð*¨FÔ3Ø�‰�h Ô'à—l‘lÐ#EÀtÇ}Á}ÐUY×U^ÑU^ÓG_Ó`ˆØ�‰Ð)¨;Ô7Ø×ÑÐ-¨{Ô;à�|‰|Ð1°4·=±=ÀÇÁÓ3KÓLˆØ�‰˜œwÐ'>Ó?Ð@ÀÐBÀDÕIr   c                 óÂ   — | j                  | j                  «      }| j                  d| j                  d|«      «       | j                  d| j                  d|«      «       y )Nzdata-nav-scopez{% nav_body_attrs %}z
href="/x/"z{% nav_back_button "/x/" %})r"   r   r0   r'   r:   s     r   Ú$test_historical_tag_names_still_workz5GRetourTagsTests.test_historical_tag_names_still_work;   sJ   € Ø—-‘- §	¡	Ó*ˆØ�‰Ð&¨¯©Ð5KÈWÓ(UÔVØ�‰�l D§L¡LÐ1NÐPWÓ$XÕYr   c                 óò  — d| j                   _        d| j                   _        | j                   j                  «        | j                  j                  | j                   «       dD ]‘  }| j                  j                  t        |«      «      }| j                  |j                  d|«       | j                  |d«       | j                  |d«       | j                  |d| j                   j                  › d�«       Œ“ y )NT)zfacturation:commande-listr,   zfacturation:produit-listéÈ   zg_retour/g_retour.jsr>   r*   r+   )r   Úis_superuserÚis_staffÚsaveÚclientÚforce_loginr   r	   r8   Ústatus_codeÚassertContainsr1   )r   ÚnameÚresponses      r   Ú8test_every_page_of_the_layout_has_the_corner_back_buttonzIGRetourTagsTests.test_every_page_of_the_layout_has_the_corner_back_button@   sÁ   € Ø!%ˆ�	‰	ÔØ!ˆ�	‰	ÔØ�	‰	�‰ÔØ�‰×Ñ §	¡	Ô*àfò 	PˆDØ—{‘{—‘¤w¨t£}Ó5ˆHØ×Ñ˜X×1Ñ1°3¸Ô=Ø×Ñ Ð*@ÔAØ×Ñ Ð*>Ô?Ø×Ñ Ð,=¸d¿i¹i¿l¹l¸^È2Ð*NÕOñ	Pr   c                 ó  — | j                  d| j                  | j                  «      «      }dD �cg c]  }|j                  |«      ‘Œ }}| j	                  |t        |«      «       | j	                  |j                  d«      d«       yc c}w )zL<- Precedent, -> Suivant, ^ Niveau superieur, actualiser, puis fil d'Ariane.r7   )zdata-g-retour-precedentzdata-g-retour-suivantzdata-g-retour-hautzdata-g-retour-actualiserzdata-g-retour-cheminz hidden é   N)r'   r"   r   Úindexr8   ÚsortedÚcount)r   ÚhtmlÚmarkerÚ	positionss       r   Ú0test_toolbar_follows_the_windows_explorer_layoutzAGRetourTagsTests.test_toolbar_follows_the_windows_explorer_layoutM   s€   € ð �|‰|Ð1°4·=±=ÀÇÁÓ3KÓLˆðOö
àð �J‰J�vÕð
ˆ	ð 
ð
 	×Ñ˜¤F¨9Ó$5Ô6à×Ñ˜Ÿ™ JÓ/°Õ3ùò
s   °B)N)Ú__name__Ú
__module__Ú__qualname__r   r"   r'   r4   r;   rC   rE   rQ   rZ   © r   r   r   r      s4   „ ò
óòiò
:òXò
JòZò
Pó4r   r   N)Ú__doc__Údjango.contrib.authr   Údjango.contrib.auth.modelsr   Údjango.templater   r   Údjango.testr   r   Údjango.urlsr	   Úfacturation.modelsr
   r   r^   r   r   ú<module>rf      s(   ðÙ På .Ý 4ß -ß 0Ý å +ôL4�xõ L4r   