+
    àajn,  ã                   óŠ   € R t ^ RIHt ^ RIHt ^ RIHtHt ^ RIH	t	 ^ RI
HtHtHtHtHtHt  ! R R]4      t ! R R	]4      tR
# )z-Tests automatises de l'application dashboard.)ÚDecimal)Úget_user_model)ÚSimpleTestCaseÚTestCase)Úreverse)ÚClientÚCommandeÚConfigurationÚLigneCommandeÚPointDeVenteÚProduitc                   ó0   a € ] tR t^t o RtR tR tRtV tR# )ÚDashboardRoutingTestsz5Regroupe les tests des routes publiques du dashboard.c                ó<   € V P                  \        R4      R4       R# )zVVerifie que la route du dashboard conserve l'espace de noms historique de facturation.úfacturation:dashboardÚ/N©ÚassertEqualr   ©Úselfs   &Ú1D:\ProjetDjango\FacControl_1.4\dashboard\tests.pyÚ;test_dashboard_route_keeps_historical_facturation_namespaceÚQDashboardRoutingTests.test_dashboard_route_keeps_historical_facturation_namespace   s   € ð 	×ÑœÐ!8Ó9¸3Ö?ó    c                ó<   € V P                  \        R4      R4       R# )zLVerifie que la route API du dashboard conserve son chemin public historique.Úapi_dashboardz/api/dashboard/Nr   r   s   &r   Ú5test_dashboard_api_route_keeps_historical_public_pathÚKDashboardRoutingTests.test_dashboard_api_route_keeps_historical_public_path   s   € ð 	×Ñœ Ó1Ð3DÖEr   © N)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r   r   r      s   ø‡ € Ù?ò@÷
Fð Fr   r   c            
       ó~   a € ] tR t^t o RtR tRRRRRRRRR	R
/R ltR tR tR t	R t
R tR tR tR tR tRtV tR# )ÚDashboardEndpointsTestsz8Regroupe les tests des ecrans et endpoints du dashboard.c                óº  € \         P                  P                  RR7      V n        \         P                  P                  RR7      V n        \        4       P                  P                  RRRV P                  R7      V n        \        4       P                  P                  RR	RV P                  R7      V n        \        P                  P                  R
R7      V n
        \        P                  P                  RR\        R4      RR7      V n        \        P                  P                  \        R4      R7       V P                  P!                  V P                  4       R# )z?Prepare les donnees communes necessaires a ce scenario de test.úPDV Dashboard)Únomú
PDV Masquezdashboard-userzdashboard-user@test.comÚ	secret123)ÚusernameÚemailÚpasswordÚpoint_de_ventezdashboard-other-userzdashboard-other-user@test.comzClient Dashboard©Únom_completúProduit DashboardzDASH-001ú1000.00ÚU)r,   Úcode_skuÚ
prix_venteÚunite_mesurez2800.00)Útaux_changeN)r   ÚobjectsÚcreater2   Úautre_point_de_venter   Úcreate_userÚuserÚ
autre_userr   Úcustomerr   r   Úproductr	   ÚclientÚforce_loginr   s   &r   ÚsetUpÚDashboardEndpointsTests.setUp   s  € ô +×2Ñ2×9Ñ9¸oÐ9ÓNˆÔÜ$0×$8Ñ$8×$?Ñ$?ÀLÐ$?Ó$QˆÔ!Ü"Ó$×,Ñ,×8Ñ8Ø%Ø+Ø Ø×.Ñ.ð	 9ó 
ˆŒ	ô )Ó*×2Ñ2×>Ñ>Ø+Ø1Ø Ø×4Ñ4ð	 ?ó 
ˆŒô Ÿ™×-Ñ-Ð:LÐ-ÓMˆŒÜ—‘×-Ñ-Ø#ØÜ˜yÓ)Øð	 .ó 
ˆŒô 	×Ñ×$Ñ$´¸Ó1CÐ$ÔDØ�‰×Ñ §	¡	Ö*r   r2   NÚvendeurrD   Útotalú1180.00Útvaú180.00c          
     óv  € \         P                  P                  T;'       g    V P                  T;'       g    V P                  Ve   TMV P
                  \        V4      \        V4      \        V4      RR7      p\        P                  P                  VV P                  \        R4      \        R4      R7       V# )z;Cree une facture et une ligne pour tester le detail CA PDV.ÚFV)r2   rH   rD   Úmontant_totalÚmontant_payeÚtva_montantÚtype_facturez1.000r6   )ÚcommandeÚproduitÚquantiteÚprix_unitaire)	r   r<   r=   r2   r@   rB   r   r
   rC   )r   r2   rH   rD   rI   rK   rS   s   &$$$$$ r   Ú_create_invoiceÚ'DashboardEndpointsTests._create_invoice:   s¡   € ô ×#Ñ#×*Ñ*Ø)×@Ð@¨T×-@Ñ-@Ø×(Ð(˜tŸy™yØ#Ò/‘6°T·]±]Ü! %›.Ü  ›Ü ›Øð +ó 
ˆô 	×Ñ×$Ñ$ØØ—L‘LÜ˜WÓ%Ü! )Ó,ð	 	%ô 	
ð ˆr   c                óÎ   € V P                   P                  \        R4      4      pV P                  VP                  ^È4       V P                  VR4       V P                  VR4       R# )zIVerifie que la page du dashboard reste accessible et correctement rendue.r   zdashboard/dashboard.htmlu   DÃ©tail par point de venteN)rD   Úgetr   r   Ústatus_codeÚassertTemplateUsedÚassertContains©r   Úresponses   & r   Ú!test_dashboard_page_still_rendersÚ9DashboardEndpointsTests.test_dashboard_page_still_rendersN   sT   € ð —;‘;—?‘?¤7Ð+BÓ#CÓDˆà×Ñ˜×-Ñ-¨sÔ3Ø×Ñ Ð*DÔEØ×Ñ˜HÐ&BÖCr   c                óª   € V P                   P                  \        R4      4      pV P                  VR4       V P	                  RVP
                  4       R# )zGVerifie que l'alerte de synchronisation MCF reste absente du dashboard.r   zSynchronisation DGI du MCFÚmcf_sync_statusN)rD   rZ   r   ÚassertNotContainsÚassertNotInÚcontextr^   s   & r   Ú-test_dashboard_does_not_render_mcf_sync_alertÚEDashboardEndpointsTests.test_dashboard_does_not_render_mcf_sync_alertW   sD   € ð —;‘;—?‘?¤7Ð+BÓ#CÓDˆà×Ñ˜xÐ)EÔFØ×ÑÐ*¨H×,<Ñ,<Ö=r   c                ó6  € V P                   P                  \        R4      4      pV P                  VP                  ^È4       VP                  4       pV P                  RV4       V P                  RV4       V P                  RV4       V P                  RV4       R# )zHVerifie que l'API du dashboard retourne toujours les sections attendues.r   ÚconfigÚ	user_infoÚstatsÚrecent_transactionsN)rD   rZ   r   r   r[   ÚjsonÚassertIn)r   r_   Úpayloads   &  r   Ú2test_dashboard_api_still_returns_expected_sectionsÚJDashboardEndpointsTests.test_dashboard_api_still_returns_expected_sections_   su   € ð —;‘;—?‘?¤7¨?Ó#;Ó<ˆà×Ñ˜×-Ñ-¨sÔ3Ø—-‘-“/ˆØ�‰�h Ô(Ø�‰�k 7Ô+Ø�‰�g˜wÔ'Ø�‰Ð+¨WÖ5r   c                ó@  € V P                  4        V P                  V P                  V P                  RRR7       V P                  P	                  \        R4      4      pV P                  VP                  ^È4       V P                  VR4       V P                  VR4       R# )zGVerifie qu'un vendeur ne voit que son point de vente dans le detail CA.ú500.00ú80.00©r2   rH   rI   rK   zfacturation:dashboard-ca-detailr+   r-   N)
rW   r>   rA   rD   rZ   r   r   r[   r]   rd   r^   s   & r   Ú3test_ca_detail_limits_points_de_vente_to_user_scopeÚKDashboardEndpointsTests.test_ca_detail_limits_points_de_vente_to_user_scopek   s‰   € ð 	×ÑÔØ×ÑØ×4Ñ4Ø—O‘OØØð	 	ô 	
ð —;‘;—?‘?¤7Ð+LÓ#MÓNˆà×Ñ˜×-Ñ-¨sÔ3Ø×Ñ˜H oÔ6Ø×Ñ˜x¨Ö6r   c                óŒ  € V P                  4       pRVn        VP                  R.R7       \        P                  P                  RR7      p\        ^4       F'  pV P                  V\        RV,           4      RR7       K)  	  \        R	4      pV P                  P                  V4      pV P                  VP                  ^È4       V P                  VR
4       V P                  VR4       V P                  VP                  R,          P!                  4       4       V P                  \#        VP                  R,          4      ^4       V P                  P                  VRR/4      pV P                  VP                  ^È4       V P                  VP                  R,          ^4       V P                  VR4       V P%                  VR4       R# )zHVerifie la recherche, la pagination et le retour dashboard des factures.zFV-SEARCH-001Únumero)Úupdate_fieldszClient Facture Paginationr3   iè  ú0.00)rD   rI   rK   z%facturation:dashboard-factures-detailzclass="factures-back-btn"u/   Rechercher par numÃ©ro, client, NIF ou code DGIÚpage_objÚfacturesÚqÚSEARCHÚfiltered_factures_countN)rW   rz   Úsaver   r<   r=   ÚrangeÚstrr   rD   rZ   r   r[   r]   Ú
assertTruerf   Úhas_nextÚlenrd   )r   Úmatched_invoiceÚother_clientÚindexÚ
detail_urlr_   Úfiltered_responses   &      r   ÚBtest_factures_detail_supports_search_pagination_and_dashboard_backÚZDashboardEndpointsTests.test_factures_detail_supports_search_pagination_and_dashboard_back|   s  € ð ×.Ñ.Ó0ˆØ!0ˆÔØ×Ñ¨H¨:ÐÔ6Ü—~‘~×,Ñ,Ð9TÐ,ÓUˆÜ˜2–YˆEØ× Ñ Ø#Ü˜$ �,Ó'Øð !ö ñ ô ÐDÓEˆ
Ø—;‘;—?‘? :Ó.ˆà×Ñ˜×-Ñ-¨sÔ3Ø×Ñ˜HÐ&AÔBØ×Ñ˜HÐ&WÔXØ�‰˜×(Ñ(¨Õ4×=Ñ=Ó?Ô@Ø×Ñœ˜X×-Ñ-¨jÕ9Ó:¸BÔ?à ŸK™KŸO™O¨J¸¸h¸ÓHÐà×ÑÐ*×6Ñ6¸Ô<Ø×ÑÐ*×2Ñ2Ð3LÕMÈqÔQØ×ÑÐ-¨Ô?Ø×ÑÐ0Ð2MÖNr   c                óÊ  € V P                  RRR7      p\        P                  P                  VP                  R7      P                  RR7       V P                  RRR7      p\        P                  P                  VP                  R7      P                  \        R	4      R
R7       V P                  P                  \        R4      4      pV P                  VP                  ^È4       V P                  VR4       V P                  VR4       V P                  VR4       V P                  VR4       V P                  VR4       V P                  VR4       V P                  VP                  R,          \        R4      4       V P                  VP                  R,          ^4       V P                  VP                  R,          P                  4       ^4       V P                  VP                  R,          P                  4       P                   \        R4      4       V P                  VR4       V P                  VR^R7       V P                  VR^R7       V P                  VR^R7       R# )zHVerifie le selecteur 10 entries per page sur les deux tableaux montants.rJ   rL   )rI   rK   )ÚpkÚPAYEE)Ústatut_paiementrt   ru   r|   ÚIMPAYEE)rP   r’   z%facturation:dashboard-montants-detailu   Factures payÃ©esu   Factures impayÃ©esu   Reste Ã  payerzTaux de paiementu   Factures payÃ©es / totalzid="resteModal"Úreste_a_payer_totalÚnb_factures_resteÚfactures_reste_listÚ500u   Factures avec reste Ã  payerz class="montants-table datatable")Úcountzdata-per-page="10"z#data-per-page-select="10,25,50,100"N)rW   r   r<   Úfilterr�   Úupdater   rD   rZ   r   r   r[   r]   rf   r˜   ÚfirstÚreste_a_payer_calc)r   Úpaid_invoiceÚunpaid_invoicer_   s   &   r   ÚHtest_montants_detail_declares_entries_per_page_on_paid_and_unpaid_tablesÚ`DashboardEndpointsTests.test_montants_detail_declares_entries_per_page_on_paid_and_unpaid_tablesš   s  € ð ×+Ñ+°)ÀÐ+ÓJˆÜ×Ñ×Ñ <§?¡?ÐÓ3×:Ñ:È7Ð:ÔSØ×-Ñ-°HÀ'Ð-ÓJˆÜ×Ñ×Ñ >×#4Ñ#4ÐÓ5×<Ñ<Ü  ›Ø%ð 	=ô 	
ð
 —;‘;—?‘?¤7Ð+RÓ#SÓTˆà×Ñ˜×-Ñ-¨sÔ3Ø×Ñ˜HÐ&8Ô9Ø×Ñ˜HÐ&:Ô;Ø×Ñ˜HÐ&6Ô7Ø×Ñ˜HÐ&8Ô9Ø×Ñ˜HÐ&@ÔAØ×Ñ˜HÐ&7Ô8Ø×Ñ˜×)Ñ)Ð*?Õ@Ä'È(ÓBSÔTØ×Ñ˜×)Ñ)Ð*=Õ>ÀÔBØ×Ñ˜×)Ñ)Ð*?Õ@×FÑFÓHÈ!ÔLØ×Ñ˜×)Ñ)Ð*?Õ@×FÑFÓH×[Ñ[Ô]dÐejÓ]kÔlØ×Ñ˜HÐ&DÔEØ×Ñ˜HÐ&HÐPQÐÔRØ×Ñ˜HÐ&:À!ÐÔDØ×Ñ˜HÐ&KÐSTÐÖUr   c                ó�  € \        4       P                  P                  RRRRV P                  R7      pV P                  P                  V4       V P                  4       pV P                  V P                  V P                  RRR7      p\        R	4      pV P                  P                  V4      pV P                  VP                  ^È4       V P                  VR
4       V P                  VR4       V P                  VR4       V P                  VR4       V P                  WRP                  4       V P                  WSP                  4       V P                  P                  VR\        V P                  P                   4      /4      pV P                  VP                  ^È4       V P                  VP"                  R,          ^4       V P                  VP"                  R,          \%        R4      4       V P                  VP"                  R,          R4       V P                  WcP                  4       V P'                  WbP                  4       R# )zEVerifie le detail des ventes du jour et le filtre par point de vente.zdashboard-adminzdashboard-admin@test.comr.   ÚADMIN)r/   r0   r1   Úroler2   rt   ru   rv   z(facturation:dashboard-ventes-jour-detailu-   DÃ©tail des ventes du jour par point de venteu   RÃ©partition par point de venter+   r-   Úpdv_idÚ	nb_ventesÚca_jourÚpdv_nom_selectedN)r   r<   r?   r2   rD   rE   rW   r>   rA   r   rZ   r   r[   r]   rz   r„   Úidrf   r   rd   )r   Ú
admin_userÚvente_pdv_principalÚvente_autre_pdvr‹   r_   rŒ   s   &      r   Ú4test_ventes_jour_detail_can_filter_by_point_de_venteÚLDashboardEndpointsTests.test_ventes_jour_detail_can_filter_by_point_de_vente·   sð  € ô $Ó%×-Ñ-×9Ñ9Ø&Ø,Ø ØØ×.Ñ.ð :ó 
ˆ
ð 	�‰×Ñ 
Ô+Ø"×2Ñ2Ó4ÐØ×.Ñ.Ø×4Ñ4Ø—O‘OØØð	 /ó 
ˆô ÐGÓHˆ
Ø—;‘;—?‘? :Ó.ˆà×Ñ˜×-Ñ-¨sÔ3Ø×Ñ˜HÐ&UÔVØ×Ñ˜HÐ&GÔHØ×Ñ˜H oÔ6Ø×Ñ˜H lÔ3Ø×Ñ˜H×&@Ñ&@ÔAØ×Ñ˜H×&<Ñ&<Ô=à ŸK™KŸO™OØØ”s˜4×4Ñ4×7Ñ7Ó8Ð9ó
Ðð
 	×ÑÐ*×6Ñ6¸Ô<Ø×ÑÐ*×2Ñ2°;Õ?ÀÔCØ×ÑÐ*×2Ñ2°9Õ=¼wÀxÓ?PÔQØ×ÑÐ*×2Ñ2Ð3EÕFÈÔUØ×ÑÐ-×/EÑ/EÔFØ×ÑÐ0×2LÑ2LÖMr   c                óþ  € V P                  4       p\        RV P                  P                  .R7      pV P                  P                  VRV P                  P                  /4      pV P                  VP                  ^È4       V P                  W1P                  4       V P                  VR4       V P                  VP                  R,          \        R4      4       V P                  VP                  R,          \        R4      4       V P                  P                  \        R	V P                  P                  .R7      RV P                  P                  /4      pV P                  VP                  ^È4       V P                  R
VR,          4       V P                  P                  \        RV P                  P                  .R7      4      pV P                  VP                  ^È4       V P                  VR,          R4       R# )zBVerifie le detail PDV, le filtre article et les exports Excel/PDF.ú facturation:dashboard-pdv-detail©ÚargsÚ
article_idr5   Úca_totalrJ   Úca_htr6   z&facturation:dashboard-pdv-export-excelÚspreadsheetmlzContent-Typez$facturation:dashboard-pdv-export-pdfzapplication/pdfN)rW   r   r2   r¨   rD   rZ   rC   r   r[   r]   rz   rf   r   ro   )r   rS   r‹   r_   Úexcel_responseÚpdf_responses   &     r   Ú3test_pdv_detail_renders_summary_filters_and_exportsÚKDashboardEndpointsTests.test_pdv_detail_renders_summary_filters_and_exportsá   s…  € ð ×'Ñ'Ó)ˆÜÐ?Àt×GZÑGZ×G]ÑG]ÐF^Ô_ˆ
à—;‘;—?‘? :°¸d¿l¹l¿o¹oÐ/NÓOˆà×Ñ˜×-Ñ-¨sÔ3Ø×Ñ˜H§o¡oÔ6Ø×Ñ˜HÐ&9Ô:Ø×Ñ˜×)Ñ)¨*Õ5´w¸yÓ7IÔJØ×Ñ˜×)Ñ)¨'Õ2´G¸IÓ4FÔGàŸ™Ÿ™ÜÐ<ÀD×DWÑDW×DZÑDZÐC[Ô\Ø˜4Ÿ<™<Ÿ?™?Ð+ó
ˆð 	×Ñ˜×3Ñ3°SÔ9Ø�‰�o ~°nÕ'EÔFà—{‘{—‘¤wÐ/UÐ]a×]pÑ]p×]sÑ]sÐ\tÔ'uÓvˆØ×Ñ˜×1Ñ1°3Ô7Ø×Ñ˜ nÕ5Ð7HÖIr   c                ó´   € V P                   P                  \        RV P                  P                  .R7      4      pV P                  VP                  R4       R# )zBVerifie qu'un vendeur ne peut pas ouvrir le detail d'un autre PDV.r¯   r°   i”  N)rD   rZ   r   r>   r¨   r   r[   r^   s   & r   Ú.test_pdv_detail_blocks_unscoped_point_de_venteÚFDashboardEndpointsTests.test_pdv_detail_blocks_unscoped_point_de_venteú   sH   € ð —;‘;—?‘?ÜÐ6¸d×>WÑ>W×>ZÑ>ZÐ=[Ô\ó
ˆð 	×Ñ˜×-Ñ-¨sÖ3r   )r>   rA   rB   r2   rC   r@   )r   r    r!   r"   r#   rF   rW   r`   rg   rq   rw   r�   rŸ   r¬   r¸   r»   r$   r%   r&   s   @r   r)   r)      so   ø‡ € ÙBò+ð6°ð ¸dð È4ð ÐW`ð Ðfnô ò(Dò>ò
6ò7ò"Oò<Vò:(NòTJ÷24ð 4r   r)   N)r#   Údecimalr   Údjango.contrib.authr   Údjango.testr   r   Údjango.urlsr   Úfacturation.modelsr   r   r	   r
   r   r   r   r)   r   r   r   Ú<module>rÂ      s6   ðÙ 3å å .ß 0Ý ç d× dôF˜Nô Fôf4˜hö f4r   