+
    '„j.%  c                   óP  € ^ RI t^ RIHu Ht ^ RIt^ RIt^ RIH	t	 ^ RI
HtHtHt ^ RIHtHtHtHtHtHt  ! R R4      t]P,                  ! RR7      R	 4       tR
 tR tR tR tR tR t]P<                  P>                  R 4       t ]P<                  P>                  R 4       t!R t"R# )é    N)Úget_database)Úcreate_sessionÚget_session_by_idÚupdate_session_status)Úadd_agent_connectionÚremove_agent_connectionÚget_agent_connectionÚhandle_agent_disconnectÚactive_sessionsÚconnected_agentsc                   ó^   a € ] tR t^t o R	V 3R lR lltV 3R lR ltR
V 3R lR lltRtV tR# )ÚMockWebSocketc                ó    <€ V ^8„  d   QhRS[ /# )é   Ú	client_id©Ústr)ÚformatÚ__classdict__s   "€ÚTC:\Users\alokc\chatbot\dev\chatbot\chatbot\backend\tests\test_multi_agent_routing.pyÚ__annotate__ÚMockWebSocket.__annotate__   s   ø€ ÷ ñ ¡#ñ ó    c                ó.   € Wn         . V n        R V n        R# )FN)r   Úsent_messagesÚ	is_closed)Úselfr   s   &&r   Ú__init__ÚMockWebSocket.__init__   s   € Ø"ŒØˆÔØˆŽr   c                ó    <€ V ^8„  d   QhRS[ /# )r   Útextr   )r   r   s   "€r   r   r      s   ø€ ÷ (ñ (¡Cñ (r   c              ƒ  ó~   "  € V P                   '       d   \        R 4      hV P                  P                  V4       R# 5i)zWebSocket is closedN)r   ÚRuntimeErrorr   Úappend)r   r    s   &&r   Ú	send_textÚMockWebSocket.send_text   s.   é € Ø�>�>ˆ>ÜÐ4Ó5Ð5Ø×Ñ×!Ñ! $Ö'ùs   ‚;=c                ó&   <€ V ^8„  d   QhRS[ RS[/# )r   ÚcodeÚreason)Úintr   )r   r   s   "€r   r   r      s   ø€ ÷ ñ ¡ð ±Cñ r   c              ƒ  ó   "  € R V n         R# 5i)TN)r   )r   r'   r(   s   &&&r   ÚcloseÚMockWebSocket.close   s   é € ØˆŽùs   ‚
)r   r   r   N)Úmock)iè  Ú )	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   r$   r+   Ú__static_attributes__Ú__classdictcell__)r   s   @r   r   r      s(   ø‡ € ÷ò ÷
(ð (÷
÷ ð r   r   T)Úautousec               #   ó¾   "  € \         P                  ! 4        \        P                  ! 4        R x € \         P                  ! 4        \        P                  ! 4        R # 5i)N)r
   Úclearr   © r   r   Úreset_presence_stater9      s8   é € ä×ÒÔÜ×ÒÔÛ	Ü×ÒÔÜ×ÒÖùs   ‚AAc                 ó,  € R \         P                  ! 4       P                  R,           R2pV P                  RRVRR/R7      pVP	                  4       R,          pR	R
V 2/pV P                  RRV/VR7      pVP
                  p^ÉqvV8H  qˆ'       gÇ   \        P                  ! R V3R!Wg34      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      R\        P                  ! V4      /,          p	RRV	/,          p
\        \        P                  ! V
4      4      hR;p;r‡VP	                  4       R,          pRVRVRRRRRRRRRRR\        R4      /\        V&   W³3# )"zshop-:Né   Nz.comz/api/v1/tenant/registerÚdomainÚnamez	Test Shop©ÚjsonÚsiteIdÚOriginzhttp://z/api/v1/session/init)r?   ÚheadersÚpy0ÚresÚpy2Úpy5úassert %(py7)sÚpy7NÚ	sessionIdÚstatusÚRINGINGÚuserÚ	ipAddressz	127.0.0.1ÚcountryÚUnknownÚconnectedAtú2026-08-18T12:00:00ZÚ	websocketÚvisitor©ú==©z3%(py2)s
{%(py2)s = %(py0)s.status_code
} == %(py5)s)ÚuuidÚuuid4ÚhexÚpostr?   Ústatus_codeÚ
@pytest_arÚ_call_reprcompareÚ@py_builtinsÚlocalsÚ_should_repr_global_nameÚ	_safereprÚAssertionErrorÚ_format_explanationr   r
   )Úclientr<   Úreg_respÚsite_idrB   rD   Ú@py_assert1Ú@py_assert4Ú@py_assert3Ú@py_format6Ú@py_format8Ú
session_ids   &           r   Úcreate_test_sessionrm   $   sB  € Ø”T—Z’Z“\×%Ñ% bÕ)Ð*¨$Ð/€FØ�{‰{Ð4¸HÀfÈfÐVaÐ;bˆ{Óc€HØ�m‰m‹o˜hÕ'€GØ˜7 6 (Ð+Ð,€GØ
�+‰+Ð,°H¸gÐ3FÐPWˆ+Ó
X€CØ�?‰?Ð!˜cÐ!˜cÑ!×!×!×!Ó!ˆ?×!×!×!×!×!×!ˆ3×!×!×!Ò!ˆ3×!×!Ö!ˆ?×!×!Ô!˜c×!×!×!×!×!×!×!Ò!Ø—‘“˜KÕ(€Jà�ZØ�'Ø�)Ø�Ø�[Ø�9ØÐ-Ø”] 9Ó-ð	#„O�JÑð ÐÐr   c           	      óv  € \        V 4      w  r\        R 4      p\        R V4       V P                  RRVRR /R7      pVP                  p^ÈqeV8H  qw'       gÇ   \
        P                  ! RV3RWV34      RR\        P                  ! 4       9   g   \
        P                  ! V4      '       d   \
        P                  ! V4      MRR\
        P                  ! V4      R\
        P                  ! V4      /,          pR	R
V/,          p	\        \
        P                  ! V	4      4      hR;p;rvVP                  4       p
V
R,          q»V8H  qÌ'       g±   \
        P                  ! RV3RW±34      R\
        P                  ! V4      RR\        P                  ! 4       9   g   \
        P                  ! V4      '       d   \
        P                  ! V4      MR/,          pRRV/,          p\        \
        P                  ! V4      4      hR;r¼V
R,          pRq{V8H  qÌ'       gy   \
        P                  ! RV3RW·34      R\
        P                  ! V4      R\
        P                  ! V4      /,          pRRV/,          p\        \
        P                  ! V4      4      hR;p;rÇV
R,          pR q{V8H  qÌ'       gy   \
        P                  ! RV3RW·34      R\
        P                  ! V4      R\
        P                  ! V4      /,          pRRV/,          p\        \
        P                  ! V4      4      hR;p;rÇ\        R 4      R,          pRq{V8H  qÌ'       gy   \
        P                  ! RV3RW·34      R\
        P                  ! V4      R\
        P                  ! V4      /,          pRRV/,          p\        \
        P                  ! V4      4      hR;p;rÇR# )Úagent_1ú/api/v1/handoff/acceptrI   ÚagentIdr>   rC   Ú
accept_resrE   rF   rG   rH   NÚpy1Úpy3rl   úassert %(py5)srJ   ÚIN_CHATÚpy4úassert %(py6)sÚpy6ÚassignedAgentIdÚBUSYrT   rV   ©z%(py1)s == %(py3)s©z%(py1)s == %(py4)s)rm   r   r   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   r?   r   )rd   rl   Ú_Úws1rr   rg   rh   ri   rj   rk   ÚdataÚ@py_assert0Ú@py_assert2Ú@py_format4Ú@py_format5Ú@py_format7s   &               r   Ú,test_first_agent_successfully_claims_sessionr†   8   s)  € Ü'¨Ó/�M€Jô ˜	Ó
"€CÜ˜ CÔ(ð —‘Ð5¸[È*ÐV_ÐajÐ<k�Ól€JØ×!Ñ!Ð( SÐ( SÑ(×(×(×(Ó(Ð!×(×(×(×(×(×(ˆ:×(×(×(Ò(ˆ:×(×(Ö(Ð!×(×(Ô( S×(×(×(×(×(×(×(Ò(Ø�?‰?Ó€DØ�ÕÐ* 
Ñ*×*×*×*Ó*Ð×*×*Õ*Ð×*×*×*×*×*Ö* 
×*×*×*Ò* 
×*×*×*×*×*×*×*Ò*Ø��>Ð&˜YÐ&˜YÑ&×&×&×&Ó&ˆ>×&×&Õ&ˆ>×&×&Ô&˜Y×&×&×&×&×&×&×&Ò&ØÐ!Õ"Ð/ iÐ/ iÑ/×/×/×/Ó/Ð"×/×/Õ/Ð"×/×/Ô/ i×/×/×/×/×/×/×/Ò/ô   	Ó*¨8Õ4Ð>¸Ð>¸Ñ>×>×>×>Ó>Ð4×>×>Õ>Ð4×>×>Ô>¸×>×>×>×>×>×>×>Ô>r   c           	      óª  € \        V 4      w  r\        R 4      p\        R4      p\        R V4       \        RV4       V P                  RRVRR /R7      pVP                  p^ÈqvV8H  qˆ'       gÇ   \
        P                  ! RV3RWg34      RR\        P                  ! 4       9   g   \
        P                  ! V4      '       d   \
        P                  ! V4      MRR\
        P                  ! V4      R	\
        P                  ! V4      /,          p	R
RV	/,          p
\        \
        P                  ! V
4      4      hR;p;r‡V P                  RRVRR/R7      pVP                  pRqvV8H  qˆ'       gÇ   \
        P                  ! RV3RWg34      RR\        P                  ! 4       9   g   \
        P                  ! V4      '       d   \
        P                  ! V4      MRR\
        P                  ! V4      R	\
        P                  ! V4      /,          p	R
RV	/,          p
\        \
        P                  ! V
4      4      hR;p;r‡VP                  4       R,          pRqŒV8H  qÝ'       gy   \
        P                  ! RV3RWÈ34      R\
        P                  ! V4      R\
        P                  ! V4      /,          pRRV/,          p\        \
        P                  ! V4      4      hR;p;rØR# )ro   Úagent_2rp   rI   rq   r>   rC   Úaccept1rE   rF   rG   rH   Ni™  Úaccept2Údetailz-Chat session already claimed by another agentrs   rw   rx   ry   rT   rV   r}   ©rm   r   r   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   r?   )rd   rl   r~   r   Úws2r‰   rg   rh   ri   rj   rk   rŠ   r�   r‚   r„   r…   s   &               r   Ú4test_second_agent_claim_attempt_returns_409_conflictrŽ   J   s¾  € Ü'¨Ó/�M€Jä
˜	Ó
"€CÜ
˜	Ó
"€CÜ˜ CÔ(Ü˜ CÔ(ð �k‰kÐ2¸+ÀzÐS\Ð^gÐ9hˆkÓi€GØ×ÑÐ% #Ð% #Ñ%×%×%×%Ó%Ð×%×%×%×%×%×%ˆ7×%×%×%Ò%ˆ7×%×%Ö%Ð×%×%Ô% #×%×%×%×%×%×%×%Ò%ð �k‰kÐ2¸+ÀzÐS\Ð^gÐ9hˆkÓi€GØ×ÑÐ% #Ð% #Ñ%×%×%×%Ó%Ð×%×%×%×%×%×%ˆ7×%×%×%Ò%ˆ7×%×%Ö%Ð×%×%Ô% #×%×%×%×%×%×%×%Ò%Ø�<‰<‹>˜(Õ#ÐVÐ'VÐVÐ'VÑV×V×V×VÓVÐ#×V×VÕVÐ#×V×VÔVÐ'V×V×V×V×V×V×V×VÔVr   c           	      ó~  a€ \        V 4      w  op\        R 4      p\        R V4       V P                  RRSRR /R7       V P	                  R4      pVP
                  p^ÈqTV8H  qf'       gÇ   \        P                  ! RV3RWE34      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      R	\        P                  ! V4      /,          pR
RV/,          p\        \        P                  ! V4      4      hR;p;reVP                  4       p	\        V3R lV	 4       R4      p
RqºVJqD'       g±   \        P                  ! RV3RW«34      RR\        P                  ! 4       9   g   \        P                  ! V
4      '       d   \        P                  ! V
4      MRR\        P                  ! V4      /,          pRR	V/,          p\        \        P                  ! V4      4      hR;rKV
R,          pR qmV8H  q»'       gy   \        P                  ! RV3RWÖ34      R\        P                  ! V4      R\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;p;r¶V
R,          pRqmVJq»'       gy   \        P                  ! RV3RWÖ34      R\        P                  ! V4      R\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;p;r¶R# )ro   rp   rI   rq   r>   z/api/v1/admin/active-sessionsrC   Ú
active_resrE   rF   rG   rH   Nc              3   óF   <"  € T F  qR ,          S8X  g   K  Vx € K  	  R# 5i)rI   Nr8   )Ú.0Úsrl   s   & €r   Ú	<genexpr>Ú@test_assigned_agent_and_assigned_at_persisted.<locals>.<genexpr>g   s   øé € ÐH™x˜!¨[­>¸ZÑ+G—A’A›xùs   ƒ!—
!Úmatchedrt   ru   rz   rs   rw   rx   ry   Ú
assignedAtrT   rV   ©úis not©z%(py0)s is not %(py3)sr}   )z%(py1)s is not %(py4)s)rm   r   r   rZ   Úgetr[   r\   r]   r^   r_   r`   ra   rb   rc   r?   Únext)rd   r~   r   r�   rg   rh   ri   rj   rk   Úsessionsr–   r‚   rƒ   r�   r„   r…   rl   s   &               @r   Ú-test_assigned_agent_and_assigned_at_persistedrž   [   sê  ø€ Ü'¨Ó/�M€J�ä
˜	Ó
"€CÜ˜ CÔ(à
‡K�KÐ(°¸ZÈÐT]Ð/^€KÔ_ð —‘Ð;Ó<€JØ×!Ñ!Ð( SÐ( SÑ(×(×(×(Ó(Ð!×(×(×(×(×(×(ˆ:×(×(×(Ò(ˆ:×(×(Ö(Ð!×(×(Ô( S×(×(×(×(×(×(×(Ò(Ø�‰Ó €HÜÔH™xÓHÈ$ÓO€GØÐ˜$Ð×××Óˆ7××××××ˆ7×××Òˆ7××Ö˜$×××××××ÐØÐ$Õ%Ð2¨Ð2¨Ñ2×2×2×2Ó2Ð%×2×2Õ2Ð%×2×2Ô2¨×2×2×2×2×2×2×2Ò2Ø�<Õ Ð,¨Ð,¨Ð,×,×,×,Ó,Ð ×,×,Õ,Ð ×,×,Ô,¨×,×,×,×,×,×,×,Ô,r   c           	      ó"  € \        V 4      w  r\        R 4      p\        R4      p\        R V4       \        RV4       V P                  RRVRR /R7       V P                  RRVRRRR/R7      pVP                  pR	qvV8H  qˆ'       gÇ   \
        P                  ! RV3RWg34      R
R\        P                  ! 4       9   g   \
        P                  ! V4      '       d   \
        P                  ! V4      MRR\
        P                  ! V4      R\
        P                  ! V4      /,          p	RRV	/,          p
\        \
        P                  ! V
4      4      hR;p;r‡VP                  4       R,          pRq‹V8H  qÌ'       gy   \
        P                  ! RV3RW¸34      R\
        P                  ! V4      R\
        P                  ! V4      /,          pRRV/,          p\        \
        P                  ! V4      4      hR;p;rÈV P                  RRVRRRR /R7      pVP                  p^ÈqvV8H  qˆ'       gÇ   \
        P                  ! RV3RWg34      R
R\        P                  ! 4       9   g   \
        P                  ! V4      '       d   \
        P                  ! V4      MRR\
        P                  ! V4      R\
        P                  ! V4      /,          p	RRV	/,          p
\        \
        P                  ! V
4      4      hR;p;r‡VP                  4       R,          pRq‹V8H  qÌ'       gy   \
        P                  ! RV3RW¸34      R\
        P                  ! V4      R\
        P                  ! V4      /,          pRRV/,          p\        \
        P                  ! V4      4      hR;p;rÈR# )ro   rˆ   rp   rI   rq   r>   z/api/v1/handoff/messageÚmessagezHello from intruderi“  rC   Úmsg2rE   rF   rG   rH   Nr‹   z You do not own this chat sessionrs   rw   rx   ry   zHello from ownerÚmsg1ÚreplyrT   rV   r}   rŒ   )rd   rl   r~   r   r�   r¡   rg   rh   ri   rj   rk   r�   r‚   r„   r…   r¢   s   &               r   Ú*test_agent_ownership_validation_on_messager¤   l   sO  € Ü'¨Ó/�M€Jä
˜	Ó
"€CÜ
˜	Ó
"€CÜ˜ CÔ(Ü˜ CÔ(ð ‡K�KÐ(°¸ZÈÐT]Ð/^€KÔ_ð �;‰;Ð0Ø�ZØÐ(Ø�9ð8ˆ;ó €Dð
 ×ÑÐ"˜sÐ"˜sÑ"×"×"×"Ó"Ð×"×"×"×"×"×"ˆ4×"×"×"Ò"ˆ4×"×"Ö"Ð×"×"Ô"˜s×"×"×"×"×"×"×"Ò"Ø�9‰9‹;�xÕ ÐFÐ$FÐFÐ$FÑF×F×F×FÓFÐ ×F×FÕFÐ ×F×FÔFÐ$F×F×F×F×F×F×F×FÒFð �;‰;Ð0Ø�ZØÐ%Ø�9ð8ˆ;ó €Dð
 ×ÑÐ"˜sÐ"˜sÑ"×"×"×"Ó"Ð×"×"×"×"×"×"ˆ4×"×"×"Ò"ˆ4×"×"Ö"Ð×"×"Ô"˜s×"×"×"×"×"×"×"Ò"Ø�9‰9‹;�wÕÐ5Ð#5Ð5Ð#5Ñ5×5×5×5Ó5Ð×5×5Õ5Ð×5×5Ô5Ð#5×5×5×5×5×5×5×5Ô5r   c                 ó	  € \        V 4      w  r\        R 4      p\        R V4       V P                  RRVRR /R7       V P                  RRVRR/R7      pVP                  p^ÈqeV8H  qw'       gÇ   \
        P                  ! RV3RWV34      RR	\        P                  ! 4       9   g   \
        P                  ! V4      '       d   \
        P                  ! V4      MR	R
\
        P                  ! V4      R\
        P                  ! V4      /,          pRRV/,          p	\        \
        P                  ! V	4      4      hR;p;rvVP                  4       R,          p
RqzV8H  q»'       gy   \
        P                  ! RV3R W§34      R\
        P                  ! V
4      R\
        P                  ! V4      /,          pRRV/,          p\        \
        P                  ! V4      4      hR;p
;r·VP                  p\        V4      p^ qæV8„  qÿ'       Eg3   \
        P                  ! R!V3R"Wn34      RR\        P                  ! 4       9   g!   \
        P                  ! \        4      '       d   \
        P                  ! \        4      MRRR\        P                  ! 4       9   g   \
        P                  ! V4      '       d   \
        P                  ! V4      MRR\
        P                  ! V4      R\
        P                  ! V4      R\
        P                  ! V4      /,          pRRV/,          p\        \
        P                  ! V4      4      hR;p;p;rþ^ RIpVP!                  VP                  R#,          4      pVR,          p
RqzV8H  q»'       gy   \
        P                  ! RV3R W§34      R\
        P                  ! V
4      R\
        P                  ! V4      /,          pRRV/,          p\        \
        P                  ! V4      4      hR;p
;r·VR,          p
R qzV8H  q»'       gy   \
        P                  ! RV3R W§34      R\
        P                  ! V
4      R\
        P                  ! V4      /,          pRRV/,          p\        \
        P                  ! V4      4      hR;p
;r·R# )$ro   rp   rI   rq   r>   z/api/v1/messager    zHelp me pleaserC   Úuser_msg_resrE   rF   rG   rH   Nr£   zMessage delivered to agent.rs   rw   rx   ry   Úlenr   rt   Úpy8úassert %(py10)sÚpy10ÚtypeÚuser_messagerz   rT   rV   r}   ©Ú>©zR%(py5)s
{%(py5)s = %(py0)s(%(py3)s
{%(py3)s = %(py1)s.sent_messages
})
} > %(py8)séÿÿÿÿ)rm   r   r   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   r?   r   r§   Úloads)rd   rl   r~   r   r¦   rg   rh   ri   rj   rk   r�   r‚   r„   r…   Ú@py_assert7Ú@py_assert6Ú@py_format9Ú@py_format11r?   Úlast_msgs   &                   r   Ú/test_visitor_message_includes_assigned_agent_idr·   ‰   s©  € Ü'¨Ó/�M€Jä
˜	Ó
"€CÜ˜ CÔ(à
‡K�KÐ(°¸ZÈÐT]Ð/^€KÔ_ð —;‘;Ð0¸ÀZÐQZÐ\lÐ7m�;Ón€LØ×#Ñ#Ð* sÐ* sÑ*×*×*×*Ó*Ð#×*×*×*×*×*×*ˆ<×*×*×*Ò*ˆ<×*×*Ö*Ð#×*×*Ô* s×*×*×*×*×*×*×*Ò*Ø×ÑÓ˜wÕ'ÐHÐ+HÐHÐ+HÑH×H×H×HÓHÐ'×H×HÕHÐ'×H×HÔHÐ+H×H×H×H×H×H×H×HÒHð × Ñ Ð%Œ3Ð Ó!Ð% AÐ% AÑ%×%×%×%Ô%Ð!×%×%×%×%×%×%Œ3×%×%×%Ò%Œ3×%×%×%×%×%×%Ð%ˆs×%×%×%Ò%ˆs×%×%Ö%Ð ×%×%Ô%Ð!×%×%Ô% A×%×%×%×%×%×%×%Ô%ÛØ�z‰z˜#×+Ñ+¨BÕ/Ó0€HØ�FÕÐ-˜~Ð-˜~Ñ-×-×-×-Ó-Ð×-×-Õ-Ð×-×-Ô-˜~×-×-×-×-×-×-×-Ò-ØÐ%Õ&Ð3¨)Ð3¨)Ñ3×3×3×3Ó3Ð&×3×3Õ3Ð&×3×3Ô3¨)×3×3×3×3×3×3×3Ô3r   c               ƒ   óÎ  "  € \        4       p \        V R R7      G Rj  x€L
 pVR,          p\        R4      p\        R4      p\        RV4       \        RV4       ^ RIHp V! WRR7      G Rj  x€L
  RVRR R	R
RRRRR\        R4      /\        V&   \        RV4       \        V R4      G Rj  x€L
  \        V,          R	,          pRqvV8H  qˆ'       gy   \        P                  ! R*V3R+Wg34      R\        P                  ! V4      R\        P                  ! V4      /,          p	RRV	/,          p
\        \        P                  ! V
4      4      hR;p;r‡\        V,          qfP                  pRq¸! V4      pRqÜVJ qî'       g»   \        P                  ! R,V3R-WÍ34      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;p;p;p;p;rí\        V,          qfP                  pRq¸! V4      pRqÜVJ qî'       g»   \        P                  ! R,V3R-WÍ34      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;p;p;p;p;rí\        W4      G Rj  x€L
 pVR	,          pRqvV8H  qˆ'       gy   \        P                  ! R*V3R+Wg34      R\        P                  ! V4      R\        P                  ! V4      /,          p	RRV	/,          p
\        \        P                  ! V
4      4      hR;p;r‡VP                  pRpV! V4      pRpVVJ pV'       gô   \        P                  ! R,V3R.VV34      RR\         P"                  ! 4       9   g   \        P$                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          pRR V/,          p\        \        P                  ! V4      4      hR;p;p;p;ppVP&                  p\)        V4      p^ pVV8„  qÌ'       Eg4   \        P                  ! R/V3R0VV34      RR!\         P"                  ! 4       9   g!   \        P$                  ! \(        4      '       d   \        P                  ! \(        4      MR!RR"\         P"                  ! 4       9   g   \        P$                  ! V4      '       d   \        P                  ! V4      MR"R\        P                  ! V4      R\        P                  ! V4      R#\        P                  ! V4      /,          pR$RV/,          p\        \        P                  ! V4      4      hR;p;p;pp^ RIpVP-                  VP&                  R1,          4      pVR%,          pR&qvV8H  qˆ'       gy   \        P                  ! R*V3R+Wg34      R\        P                  ! V4      R\        P                  ! V4      /,          p	RRV	/,          p
\        \        P                  ! V
4      4      hR;p;r‡VR,          qfV8H  qˆ'       g±   \        P                  ! R*V3R2Wb34      R\        P                  ! V4      RR'\         P"                  ! 4       9   g   \        P$                  ! V4      '       d   \        P                  ! V4      MR'/,          pR(RV/,          p\        \        P                  ! V4      4      hR;rhV! WRR7      G Rj  x€L
 pRpVVJpV'       g²   \        P                  ! R3V3R4VV34      RR)\         P"                  ! 4       9   g   \        P$                  ! V4      '       d   \        P                  ! V4      MR)R\        P                  ! V4      /,          pR(RV/,          p\        \        P                  ! V4      4      hR;ppVR,          pRqvV8H  qˆ'       gy   \        P                  ! R*V3R+Wg34      R\        P                  ! V4      R\        P                  ! V4      /,          p	RRV	/,          p
\        \        P                  ! V
4      4      hR;p;r‡VR	,          pR
qvV8H  qˆ'       gy   \        P                  ! R*V3R+Wg34      R\        P                  ! V4      R\        P                  ! V4      /,          p	RRV	/,          p
\        \        P                  ! V
4      4      hR;p;r‡R#  E	L¹ E	Lm E	L2 EL  ELü5i)5Úsite_demo_123©rf   NrI   Úagent_alphaÚ
agent_beta©Úclaim_session_atomically©Úagent_idr@   rJ   rv   rz   r—   rQ   rR   rS   rK   rs   rw   rx   ry   rt   rF   rH   rª   zassert %(py12)sÚpy12rC   ÚfetchedrE   Úpy9zassert %(py11)sÚpy11r§   r�   r¨   r©   r«   Úvisitor_requeuedrl   ru   Úclaimed_betarT   r}   )Úis)zJ%(py7)s
{%(py7)s = %(py3)s
{%(py3)s = %(py1)s.get
}(%(py5)s)
} is %(py10)s)zI%(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.get
}(%(py4)s)
} is %(py9)sr­   r¯   r°   r|   r˜   rš   )r   r   r   r   Ú#app.repositories.session_repositoryr¾   r
   r   r	   r\   r]   ra   rb   rc   r›   r   r^   r_   r`   r   r§   r?   r±   )ÚdbÚsessionrl   r   r�   r¾   r�   ri   r‚   r„   r…   rh   r³   Ú@py_assert9Ú@py_assert8rµ   Ú@py_format13rÂ   rg   Ú@py_assert5r²   Ú@py_format10Ú@py_format12r´   r?   Úrequeue_eventrƒ   rj   rÆ   s                                r   Ú/test_agent_disconnect_causes_requeue_to_ringingrÒ   �   sü  é € ä	‹€BÜ" 2¨Ô?×?€GØ˜Õ%€Jä
˜Ó
&€CÜ
˜Ó
%€CÜ˜¨Ô,Ü˜ sÔ+õ MÙ
" 2¸MÔ
J×JÐJð 	�ZØ�/Ø�)Ø˜=ØÐ,Ø”] 9Ó-ð#„O�JÑô ˜M¨3Ô/Ü
! " mÓ
4×4Ð4ô ˜:Õ& xÕ0Ð=°IÐ=°IÑ=×=×=×=Ó=Ð0×=×=Õ=Ð0×=×=Ô=°I×=×=×=×=×=×=×=Ò=Ü˜:Õ&ÐE×*Ñ*ÐEÐ+<ÐEÐ*Ð+<Ó=ÐEÀÐEÀÐE×E×E×EÓEÐ=×E×EÕEÐ&×E×EÔEÐ*×E×EÔEÐ+<×E×EÔEÐ=×E×EÔEÀ×E×E×E×E×E×E×E×EÐEÜ˜:Õ&Ð@×*Ñ*Ð@¨<Ð@Ð*¨<Ó8Ð@¸DÐ@¸DÐ@×@×@×@Ó@Ð8×@×@Õ@Ð&×@×@Ô@Ð*×@×@Ô@¨<×@×@Ô@Ð8×@×@Ô@¸D×@×@×@×@×@×@×@×@Ð@ô & bÓ5×5€GØ�8ÕÐ) 	Ð) 	Ñ)×)×)×)Ó)Ð×)×)Õ)Ð×)×)Ô) 	×)×)×)×)×)×)×)Ò)Ø�;‰;Ð1Ð(Ð1‰;Ð(Ó)Ð1¨TÐ1Ð)¨TÐ1×1×1×1Ô1Ð)¨T×1×1×1×1×1×1ˆ7×1×1×1Ò1ˆ7×1×1Ö1ˆ;×1×1Ô1Ð(×1×1Ô1Ð)×1×1Ô1¨T×1×1×1×1×1×1×1×1ð × Ñ Ð%Œ3Ð Ó!Ð% AÐ%Ð! AÑ%×%×%×%Ô%Ð! A×%×%×%×%×%×%Œ3×%×%×%Ò%Œ3×%×%×%×%×%×%Ð%ˆs×%×%×%Ò%ˆs×%×%Ö%Ð ×%×%Ô%Ð!×%×%Ô% A×%×%×%×%×%×%×%Õ%ÛØ—J‘J˜s×0Ñ0°Õ4Ó5€MØ˜Õ Ð6Ð$6Ð6Ð$6Ñ6×6×6×6Ó6Ð ×6×6Õ6Ð ×6×6Ô6Ð$6×6×6×6×6×6×6×6Ò6Ø˜Õ%Ð3¨Ñ3×3×3×3Ó3Ð%×3×3Õ3Ð%×3×3×3×3×3Ö3¨×3×3×3Ò3¨×3×3×3×3×3×3×3Ò3ñ 2°"È<ÔX×X€LØ#Ð#ˆ<˜tÐ#×#×#×#Ô#ˆ<˜t×#×#×#×#×#×#ˆ<×#×#×#Ò#ˆ<×#×#Ö#˜t×#×#×#×#×#×#×#Ñ#ØÐ)Õ*Ð:¨lÐ:¨lÑ:×:×:×:Ó:Ð*×:×:Õ:Ð*×:×:Ô:¨l×:×:×:×:×:×:×:Ò:Ø˜Õ!Ð. YÐ. YÑ.×.×.×.Ó.Ð!×.×.Õ.Ð!×.×.Ô. Y×.×.×.×.×.×.×.Ô.ò] @ò Kò 5ò 6ò Yùs„   ‚g%�gžAg%Á,gÁ-=g%Â*gÂ+Jg%Ì?gÍ Dg%ÑD&g%Õ4Ag%×Gg%ÞAg%ß&g"ß'g%ß9Ag%áFg%çg%çg%çg%ç"g%c              ƒ   óê  "  € \        4       p\        VR R7      G Rj  x€L
 pVR,          p\        R4      p\        RV4       ^ RIHp V! WRR7      G Rj  x€L
  \        WR4      G Rj  x€L
  RVRR R	RR
R/\        V&   \        RV4       \        VR4      G Rj  x€L
  \        V,          R	,          pRqvV8H  qˆ'       gy   \        P                  ! RV3RWg34      R\        P                  ! V4      R\        P                  ! V4      /,          p	RRV	/,          p
\        \        P                  ! V
4      4      hR;p;r‡\        W4      G Rj  x€L
 pVR	,          pRqvV8H  qˆ'       gy   \        P                  ! RV3RWg34      R\        P                  ! V4      R\        P                  ! V4      /,          p	RRV	/,          p
\        \        P                  ! V
4      4      hR;p;r‡R#  ELÈ EL“ EL‚ ELT L¥5i)r¹   rº   NrI   ro   r½   r¿   ÚENDEDr@   rJ   rz   rs   rw   rx   ry   rT   r}   )r   r   r   r   rÈ   r¾   r   r
   r   r	   r\   r]   ra   rb   rc   r   )rd   rÉ   rÊ   rl   r   r¾   r�   ri   r‚   r„   r…   rÂ   s   &           r   Ú*test_ending_ended_session_does_not_requeuerÕ   Ð   sp  é € ä	‹€BÜ" 2¨Ô?×?€GØ˜Õ%€Jä
˜	Ó
"€CÜ˜ CÔ(õ MÙ
" 2¸IÔ
F×FÐFÜ
 °Ó
8×8Ð8ð 	�ZØ�/Ø�'Ø˜9ð	#„O�JÑô ˜I sÔ+Ü
! " iÓ
0×0Ð0ô ˜:Õ& xÕ0Ð;°GÐ;°GÑ;×;×;×;Ó;Ð0×;×;Õ;Ð0×;×;Ô;°G×;×;×;×;×;×;×;Ò;Ü% bÓ5×5€GØ�8ÕÐ' Ð' Ñ'×'×'×'Ó'Ð×'×'Õ'Ð×'×'Ô' ×'×'×'×'×'×'×'Ô'ò3 @ò GÚ8ò 1ñ 6ùsY   ‚G3�G%ž7G3ÁG(ÁG3Á)G+Á*0G3ÂG.ÂB0G3ÅG1ÅBG3Ç(G3Ç+G3Ç.G3Ç1G3c                 ó¤	  € \        V 4      w  r\        R 4      p\        R4      p\        R V4       \        RV4       V P                  RRVRR /R7      pVP                  p^ÈqvV8H  qˆ'       gÇ   \
        P                  ! RV3RWg34      RR\        P                  ! 4       9   g   \
        P                  ! V4      '       d   \
        P                  ! V4      MRR\
        P                  ! V4      R	\
        P                  ! V4      /,          p	R
RV	/,          p
\        \
        P                  ! V
4      4      hR;p;r‡^ RIpVP                   Uu. uF  qËP                  V4      NK  	  ppV Uu. uF  qÌP!                  R4      R8X  g   K  VNK  	  pp\#        V4      p^ pVV8„  qw'       Eg   \
        P                  ! RV3R VV34      RR\        P                  ! 4       9   g!   \
        P                  ! \"        4      '       d   \
        P                  ! \"        4      MRRR\        P                  ! 4       9   g   \
        P                  ! V4      '       d   \
        P                  ! V4      MRR\
        P                  ! V4      R\
        P                  ! V4      /,          pRRV/,          p\        \
        P                  ! V4      4      hR;p;ppV^ ,          pVR,          pVV8H  qÿ'       g²   \
        P                  ! RV3R!VV34      R\
        P                  ! V4      RR\        P                  ! 4       9   g   \
        P                  ! V4      '       d   \
        P                  ! V4      MR/,          pRR	V/,          p	\        \
        P                  ! V	4      4      hR;ppVR,          pR pVV8H  qÿ'       gz   \
        P                  ! RV3R"VV34      R\
        P                  ! V4      R\
        P                  ! V4      /,          pRRV/,          p\        \
        P                  ! V4      4      hR;p;røVR,          pRpVV8H  qÿ'       gz   \
        P                  ! RV3R"VV34      R\
        P                  ! V4      R\
        P                  ! V4      /,          pRRV/,          p\        \
        P                  ! V4      4      hR;p;røR# u upi u upi )#ro   rˆ   rp   rI   rq   r>   rC   rr   rE   rF   rG   rH   Nr«   Úchat_claimedr§   rs   Úclaimed_eventsrt   ry   zassert %(py8)sr¨   rl   ru   rz   rw   rx   rJ   rv   rT   rV   r­   )z/%(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} > %(py6)sr|   r}   )rm   r   r   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   r?   r   r±   r›   r§   )rd   rl   rf   r   r�   rr   rg   rh   ri   rj   rk   r?   ÚmÚws2_messagesrØ   r‚   rÎ   r…   r´   Úeventr�   rƒ   r„   s   &                      r   Ú2test_chat_claim_realtime_broadcast_to_other_agentsrÜ   î   sá  € Ü-¨fÓ5Ñ€Jô ˜	Ó
"€CÜ
˜	Ó
"€CÜ˜ CÔ(Ü˜ CÔ(ð —‘Ð5¸[È*ÐV_ÐajÐ<k�Ól€JØ×!Ñ!Ð( SÐ( SÑ(×(×(×(Ó(Ð!×(×(×(×(×(×(ˆ:×(×(×(Ò(ˆ:×(×(Ö(Ð!×(×(Ô( S×(×(×(×(×(×(×(Ò(ó Ø+.×+<Ò+<Ó=Ñ+< a—J‘J˜q–MÑ+<€LÐ=Ù!-ÓQ¡˜A·±°v³À.Ñ1P—a�a¡€NÐQÜˆ~ÓÐ" Ð"Ð Ñ"×"×"×"Ô"Ð ×"×"×"×"×"×"Œ3×"×"×"Ò"Œ3×"×"×"×"×"×"Ð"ˆ~×"×"×"Ò"ˆ~×"×"Ö"Ð×"×"Ô" ×"×"×"×"×"×"×"Ó"à˜1Õ€EØ�ÕÐ+Ð Ñ+×+×+×+Ó+Ð ×+×+Õ+Ð×+×+×+×+×+Ö+ ×+×+×+Ò+ ×+×+×+×+×+×+×+Ó+ØÐ"Õ#Ð0 yÐ0Ð# yÑ0×0×0×0Ó0Ð# y×0×0Õ0Ð#×0×0Ô0 y×0×0×0×0×0×0×0Ò0Ø��?Ð'˜iÐ'ˆ?˜iÑ'×'×'×'Ó'ˆ?˜i×'×'Õ'ˆ?×'×'Ô'˜i×'×'×'×'×'×'×'Ô'ùò >ùÚQs   Å	SÅ(SÆS)#Úbuiltinsr^   Ú_pytest.assertion.rewriteÚ	assertionÚrewriter\   rW   ÚpytestÚapp.databaser   rÈ   r   r   r   Úapp.services.presencer   r   r   r	   r
   r   r   Úfixturer9   rm   r†   rŽ   rž   r¤   r·   ÚmarkÚanyiorÒ   rÕ   rÜ   r8   r   r   Ú<module>rç      sª   ðß  „ ƒÛ Ý %ß hÑ h÷÷ ÷ñ ð ‡‚˜Ôñó ðòò(?ò$Wò"-ò"6ò:4ð( ‡�×Ññ0/ó ð0/ðd ‡�×Ññ(ó ð(ô:(r   