o
    |ú^j§  ã                   @  sb   d Z ddlmZ ddlZddlmZmZmZmZm	Z	m
Z
 G dd„ dejƒZedkr/e ¡  dS dS )uR   Regression tests for LSQ prospect resolution â€” customer vs agent phone mismatch.é    )ÚannotationsN)Ú_accept_customer_prospectÚ_agent_phone_coresÚ_customer_phone_candidatesÚ_lead_is_agent_prospectÚ_lead_matches_customer_phonesÚcall_dict_for_lsq_pushc                   @  sD   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dS )ÚLsqProspectResolutionTestsc              	   C  s<   dddddddddœ}t |ƒ}|  |dg¡ |  d|¡ d S )NÚ99862429051783490087ÚoutboundzPooja KumarÚ
9986242905Ú
8281553440)ÚcallidÚ	directionÚ	agentnameÚcallfromÚcalltoÚcustomer_callinfoÚcustomer_phoneÚagent_callinfo©r   ÚassertEqualÚassertNotIn©ÚselfÚcallÚphones© r   úG/home/aiteam/pcaa-dev/dashboard-backend/test_lsq_prospect_resolution.pyÚ"test_outbound_excludes_agent_phone   s   ø
z=LsqProspectResolutionTests.test_outbound_excludes_agent_phonec                 C  s8   dddddddœ}t |ƒ}|  |dg¡ |  d|¡ d S )NÚ98201313321782888128ÚinboundÚ
9739390254Ú
9820131332)r   r   r   r   r   r   r   r   r   r   r   Ú!test_inbound_keeps_customer_phone!   s   úz<LsqProspectResolutionTests.test_inbound_keeps_customer_phonec                 C  s8   dddddddœ}t |ƒ}|  |dg¡ |  d|¡ dS )zGIf customer_callinfo was wrongly stored as the agent, still use callto.r   r   r   )r   r   r   r   r   r   Nr   r   r   r   r   Ú0test_swapped_customer_phone_falls_back_to_callto.   s   úzKLsqProspectResolutionTests.test_swapped_customer_phone_falls_back_to_calltoc                 C  s2   dd dœ}|   t|dgƒ¡ |  t|dgƒ¡ d S )Nz+91-8281553440)ÚPhoneÚMobiler   r   )Ú
assertTruer   ÚassertFalse)r   Úleadr   r   r   Ú*test_lead_phone_match_handles_country_code<   s   
zELsqProspectResolutionTests.test_lead_phone_match_handles_country_codec                 C  sH   dddddœ}t |ƒ}|  d|¡ t|ƒ}|  |dg¡ |  d|¡ d S )NÚ79960405061784010167r   Ú
7996040506Ú
9842654716)r   r   r   r   )r   ÚassertInr   r   r   )r   r   Úcoresr   r   r   r   Ú,test_outbound_callid_prefix_treated_as_agentA   s   üzGLsqProspectResolutionTests.test_outbound_callid_prefix_treated_as_agentc                 C  sX   dddœ}dddœ}dh}|   t||ƒ¡ |  t|dg|ƒ¡ |  t|dg|ƒd¡ d S )Nz522349e6-agentz+91-7996040506)Ú
ProspectIDr&   zbd8b2162-customerz+91-9842654716r-   r.   )r(   r   ÚassertIsNoner   r   )r   Ú
agent_leadÚcustomer_leadÚagent_coresr   r   r   Ú4test_reject_agent_prospect_even_if_search_returns_itN   s   þþÿþzOLsqProspectResolutionTests.test_reject_agent_prospect_even_if_search_returns_itc                 C  sj   t dddddddœƒ}|  |d d¡ |  |d	 d¡ |  |d
 d¡ |  |d d¡ |  |d d¡ d S )Nr,   r   ÚBidhiskar-   r.   z2026-07-14 11:52:48)r   r   r   r   r   Úcall_starttimer   r   r   r   Úclicktocalldid)r   r   ÚassertNotEqual)r   Úshapedr   r   r   Ú0test_call_dict_outbound_keeps_customer_and_agenta   s   úÿ
zKLsqProspectResolutionTests.test_call_dict_outbound_keeps_customer_and_agentN)
Ú__name__Ú
__module__Ú__qualname__r   r$   r%   r+   r1   r7   r=   r   r   r   r   r	      s    r	   Ú__main__)Ú__doc__Ú
__future__r   ÚunittestÚleadsquared_activity_pushr   r   r   r   r   r   ÚTestCaser	   r>   Úmainr   r   r   r   Ú<module>   s     
bÿ