Ë
    vl)jƒ   ã                   óÞ   — d Z ddlmZ ddlmZ ddlmZmZ ddlm	Z	 ddl
mZmZ ddlmZ dd	lmZmZmZmZmZmZmZ dd
lm Z!m"Z#m$Z%m&Z'm(Z)m*Z+  G d„ de«      Z, G d„ de«      Z- G d„ de«      Z.y)z0Tests automatises de l'application comptabilite.é    )ÚDecimal)Úget_user_model)ÚSimpleTestCaseÚTestCase)Úreverse)ÚConfigurationÚPointDeVenteé   ©ÚRapportViewSet©Úbuild_chiffre_affaires_payloadÚ build_rapport_journalier_contextÚbuild_rapport_mensuel_contextÚ)build_rapport_mensuel_point_vente_contextÚ&build_rapport_mensuel_taxation_contextÚ*build_rapport_mensuel_type_facture_contextÚbuild_rapport_vendeurs_context©ÚRapportJournalierViewÚRapportMensuelPointVenteViewÚRapportMensuelViewÚRapportMensuelTaxationViewÚRapportMensuelTypeFactureViewÚRapportVendeursViewc                   ó   — e Zd ZdZd„ Zy)ÚComptabiliteRoutingTestszCVerifie que les routes publiques des etats simples restent stables.c                 ó   — | j                  t        d«      d«       | j                  t        d«      d«       | j                  t        d«      d«       | j                  t        d«      d«       | j                  t        d	«      d
«       | j                  t        d«      d«       | j                  t        d«      d«       | j                  t        d«      d«       | j                  t        d«      d«       | j                  t        d«      d«       y)zJConserve les chemins publics des rapports simples exposes par facturation.úfacturation:rapport-journalierz/rapport/journalier/z+facturation:rapport-journalier-export-excelz!/rapport/journalier/export-excel/úfacturation:rapport-mensuelz/rapport/mensuel/ú$facturation:rapport-mensuel-taxationz/rapport/mensuel/taxation/z1facturation:rapport-mensuel-taxation-export-excelz'/rapport/mensuel/taxation/export-excel/ú(facturation:rapport-mensuel-points-ventez/rapport/mensuel/points-vente/z5facturation:rapport-mensuel-points-vente-export-excelz+/rapport/mensuel/points-vente/export-excel/ú)facturation:rapport-mensuel-types-facturez/rapport/mensuel/types-facture/z6facturation:rapport-mensuel-types-facture-export-excelz,/rapport/mensuel/types-facture/export-excel/úfacturation:rapport-vendeursz/rapport/vendeurs/N)ÚassertEqualr   ©Úselfs    úa/home/exaucensingi/Documents/ProjectPython/GBM_FacControl/faccontrol_acokin/comptabilite/tests.pyÚ*test_public_report_routes_keep_their_pathszCComptabiliteRoutingTests.test_public_report_routes_keep_their_paths"   sÿ   € ð 	×ÑœÐ!AÓBÐDZÔ[Ø×ÑœÐ!NÓOÐQtÔuØ×ÑœÐ!>Ó?ÐATÔUØ×ÑœÐ!GÓHÐJfÔgØ×ÑœÐ!TÓUð  XAô  	BØ×ÑœÐ!KÓLÐNnÔoØ×ÑœÐ!XÓYð  \Iô  	JØ×ÑœÐ!LÓMÐOpÔqØ×ÑœÐ!YÓZð  ]Kô  	LØ×ÑœÐ!?Ó@ÐBVÕWó    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r)   © r*   r(   r   r      s   „ ÙMóXr*   r   c                   ó   — e Zd ZdZd„ Zy)ÚComptabiliteCompatibilityTestsz>Verifie les facades de compatibilite conservees dans rapports.c                 ó:  — ddl m} ddlm}m}m}m}m}m}m	} ddl
m}	m}
m}m}m}m} | j#                  t%        |	t&        «      «       | j#                  t%        |t(        «      «       | j#                  t%        |t*        «      «       | j#                  t%        |
t,        «      «       | j#                  t%        |t.        «      «       | j#                  t%        |t0        «      «       | j#                  t%        |t2        «      «       | j5                  |t6        «       | j5                  |t8        «       | j5                  |t:        «       | j5                  |t<        «       | j5                  |t>        «       | j5                  |t@        «       | j5                  |tB        «       y)zJControle que rapports reste un point d'entree compatible apres extraction.r   r   r   r   N)"Úrapports.api_viewsr   Úrapports.servicesr   r   r   r   r   r   r   Úrapports.viewsr   r   r   r   r   r   Ú
assertTrueÚ
issubclassÚBaseRapportJournalierViewÚBaseRapportMensuelViewÚBaseRapportMensuelTaxationViewÚ BaseRapportMensuelPointVenteViewÚ!BaseRapportMensuelTypeFactureViewÚBaseRapportVendeursViewÚBaseRapportViewSetÚassertIsÚ!BaseBuildRapportJournalierContextÚBaseBuildRapportMensuelContextÚ&BaseBuildRapportMensuelTaxationContextÚ(BaseBuildRapportMensuelPointVenteContextÚ)BaseBuildRapportMensuelTypeFactureContextÚBaseBuildRapportVendeursContextÚBaseBuildChiffreAffairesPayload)r'   ÚRapportsRapportViewSetÚ#RapportsBuildChiffreAffairesPayloadÚ%RapportsBuildRapportJournalierContextÚ"RapportsBuildRapportMensuelContextÚ,RapportsBuildRapportMensuelPointVenteContextÚ*RapportsBuildRapportMensuelTaxationContextÚ-RapportsBuildRapportMensuelTypeFactureContextÚ#RapportsBuildRapportVendeursContextÚRapportsRapportJournalierViewÚ$RapportsRapportMensuelPointVenteViewÚRapportsRapportMensuelViewÚ"RapportsRapportMensuelTaxationViewÚ%RapportsRapportMensuelTypeFactureViewÚRapportsRapportVendeursViews                  r(   Ú+test_rapports_reexports_simple_report_layerzJComptabiliteCompatibilityTests.test_rapports_reexports_simple_report_layer4   s&  € õ 	P÷	
÷ 	
ñ 	
÷	
÷ 	
ð 	�‰œ
Ð#@ÔB[Ó\Ô]Ø�‰œ
Ð#=Ô?UÓVÔWØ�‰œ
Ð#EÔGeÓfÔgØ�‰œ
Ð#GÔIiÓjÔkØ�‰œ
Ð#HÔJkÓlÔmØ�‰œ
Ð#>Ô@WÓXÔYØ�‰œ
Ð#9Ô;MÓNÔOØ�‰Ð;Ô=^Ô_Ø�‰Ð8Ô:XÔYØ�‰Ð@ÔBhÔiØ�‰ÐBÔDlÔmØ�‰ÐCÔEnÔoØ�‰Ð9Ô;ZÔ[Ø�‰Ð9Ô;ZÕ[r*   N)r+   r,   r-   r.   rU   r/   r*   r(   r1   r1   1   s   „ ÙHó#\r*   r1   c                   ó"   — e Zd ZdZd„ Zd„ Zd„ Zy)ÚComptabiliteEndpointsTestsz;Verifie que les ecrans et l'API simple restent accessibles.c                 ój  — t         j                  j                  d¬«      | _        t	        «       j                  j                  ddddd| j                  ¬«      | _        t        j                  j                  t        d	«      d
ddddddd¬«	       | j                  j                  | j                  «       y)zCPrepare un utilisateur administrateur et sa configuration minimale.zPDV Comptabilite)Únomzadmin-comptabilitezadmin-comptabilite@test.comÚ	secret123ÚADMINT)ÚusernameÚemailÚpasswordÚroleÚis_staffÚpoint_de_ventez2800.00zFacControl TestzAdresse testÚ	A1234567Qz	RCCM-TESTz
IDNAT-TESTÚ	000000000zISF-TESTÚttc)	Útaux_changeÚnom_entrepriseÚadresseÚnifÚrccmÚid_natÚ	telephoneÚisf_dgiÚmode_dgiN)r	   ÚobjectsÚcreatera   r   Úcreate_userÚuserr   r   ÚclientÚforce_loginr&   s    r(   ÚsetUpz ComptabiliteEndpointsTests.setUp]   s¬   € ô +×2Ñ2×9Ñ9Ð>PÐ9ÓQˆÔÜ"Ó$×,Ñ,×8Ñ8Ø)Ø/Ø ØØØ×.Ñ.ð 9ó 
ˆŒ	ô 	×Ñ×$Ñ$Ü 	Ó*Ø,Ø"ØØØØ!ØØð 	%ô 
	
ð 	�‰×Ñ §	¡	Õ*r*   c                 óæ   — d}|D ]j  \  }}}| j                   j                  t        |«      «      }| j                  |j                  d«       | j                  ||«       | j                  ||«       Œl y)zKControle que les ecrans utilisent toujours les chemins publics historiques.))r   z rapports/rapport_journalier.htmlz$comptabilite/rapport_journalier.html)r    úrapports/rapport_mensuel.htmlú!comptabilite/rapport_mensuel.html)r!   rv   rw   )r"   rv   rw   )r#   rv   rw   )r$   zrapports/rapport_vendeurs.htmlz"comptabilite/rapport_vendeurs.htmléÈ   N)rr   Úgetr   r%   Ústatus_codeÚassertTemplateUsed)r'   ÚexpectationsÚ
route_nameÚpublic_templateÚsource_templateÚresponses         r(   Ú<test_simple_report_pages_render_with_compatibility_templateszWComptabiliteEndpointsTests.test_simple_report_pages_render_with_compatibility_templatesv   so   € ð
ˆð =Iò 	?Ñ8ˆJ˜¨Ø—{‘{—‘¤w¨zÓ':Ó;ˆHØ×Ñ˜X×1Ñ1°3Ô7Ø×#Ñ# H¨oÔ>Ø×#Ñ# H¨oÕ>ñ		?r*   c                 óþ   — | j                   j                  d«      }| j                  |j                  d«       |j	                  «       }| j                  d|«       | j                  d|«       | j                  d|«       y)zDVerifie que l'endpoint de synthese conserve sa structure de reponse.z/api/rapports/chiffre_affaires/rx   Úchiffre_affaires_totalÚtotal_encaisseÚcreancesN)rr   ry   r%   rz   ÚjsonÚassertIn)r'   r€   Úpayloads      r(   Ú-test_chiffre_affaires_api_keeps_payload_shapezHComptabiliteEndpointsTests.test_chiffre_affaires_api_keeps_payload_shapeˆ   sd   € ð —;‘;—?‘?Ð#DÓEˆà×Ñ˜×-Ñ-¨sÔ3Ø—-‘-“/ˆØ�‰Ð.°Ô8Ø�‰Ð&¨Ô0Ø�‰�j 'Õ*r*   N)r+   r,   r-   r.   rt   r�   r‰   r/   r*   r(   rW   rW   Z   s   „ ÙEò+ò2?ó$	+r*   rW   N)/r.   Údecimalr   Údjango.contrib.authr   Údjango.testr   r   Údjango.urlsr   Úfacturation.modelsr   r	   Ú	api_viewsr   r>   Úservicesr   rF   r   r@   r   rA   r   rC   r   rB   r   rD   r   rE   Úviewsr   r8   r   r;   r   r9   r   r:   r   r<   r   r=   r   r1   rW   r/   r*   r(   ú<module>r’      s\   ðÙ 6å å .ß 0Ý ç :å ;÷÷ ñ ÷÷ ôX˜~ô Xô$&\ ^ô &\ôR7+ õ 7+r*   