
    9i-                         S r SSKrSSKJs  Jr  SSKrSSKJ	r	  SSK
JrJrJrJr  SSKrSSKJr  SSKJr  SSKJr  SSKJrJrJrJrJrJr   " S	 S
5      r " S S5      r " S S5      rg)z3Tests for WebSocket live race update functionality.    N)date)	AsyncMock	MagicMockMockpatch)
TestClient)app)ConnectionManager)DriverHorseMeetingRaceStarterTrainerc                   x    \ rS rSrSr\R                  S 5       r\R                  S 5       rS r	S r
S rS rS	rg
)TestWebSocket   z*Tests for WebSocket race update endpoints.c                 d   [        [        S9nSUl        [        SSS5      Ul        [        [
        S9nSUl        SUl        [        [        S9nSUl        S	Ul        [        [        S9nS
Ul        SUl        [        [        S9nSUl        SUl        SUl        S
Ul        SUl        SUl        SUl        SUl        SUl        X%l        X5l        XEl        [        [,        S9nSUl        SUl        SUl        SUl        SUl        SUl        SUl        SUl        SUl        Xl        U/Ul         U$ )z(Create a mock race with related objects.)spec
Test Venuei        d   
Test Horse
   zTest Driver   zTest Trainer   NF*   M1   i  MobilePaceFineGood)!r   r   venuer   meeting_dater   idnamer   r   r   horse_id	driver_id
trainer_idrunner_numberbarrier
handicap_mplacingdid_not_finishhorsedrivertrainerr   
meeting_idrace_number
distance_m
start_typegaitweathertrack_conditionrace_datetimemeetingstarters)selfmock_meeting
mock_horsemock_drivermock_trainermock_starter	mock_races          9/root/tipsharks/tipsharks-elo-api/tests/test_websocket.pyrD   TestWebSocket.mock_race   s9    ))$(q!$4!u%

&
'()*) #!#"$%&" "$#&+#')+dO		#	 !	#	'		"	$*	!"&	(*^	    c              #     #    [        5       nS Ul        [        S5       n[        SU5         [        5       n[        5       nXTR                  l        XCl        [        5       nXR                  R
                  R                  l        XfR                  l        XeR                  l        [        [        5       nUv   SSS5        SSS5        SSS5        g! , (       d  f       N= f! , (       d  f       N(= f! , (       d  f       g= f7f)zCreate a test client with mocked DB session and real WebSocket manager.

Uses a real ConnectionManager (to properly accept WebSocket connections)
but prevents the background simulation from starting.
c                     g)NT )race_ids    rE   <lambda>&TestWebSocket.client.<locals>.<lambda>L   s    TrG   !apps.backend.api.main.get_sessionz"apps.backend.api.websocket.managerN)r
   is_simulation_runningr   r   	__enter__return_valuer   filterfirstoptionsqueryr   r	   )r>   rD   test_managermock_get_sessionmock_session_ctxmock_session
mock_querytest_clients           rE   clientTestWebSocket.clientB   s      )*-A* 56:J6E  ){$;L6B&&3,<) J@I**00=.8+.8+CK!! ! F 76  ! FE 76sL   DC5BC$5C:C$C5
	D
C!C$$
C2	.C55
D?Dc                    [        S5       n[        5       n[        5       nXTR                  l        XCl        [	        5       nSUR
                  R                  R                  l        XeR                  l        [        R                  " [        5         UR                  S5          SSS5        SSS5        SSS5        g! , (       d  f       N= f! , (       d  f       N(= f! , (       d  f       g= f)zITest WebSocket connection with non-existent race returns close code 4004.rN   Nz/ws/races/999)r   r   rP   rQ   r   rR   rS   rU   pytestraises	Exceptionwebsocket_connect)r>   r\   rD   rW   rX   rY   rZ   s          rE   %test_websocket_connect_race_not_found3TestWebSocket.test_websocket_connect_race_not_foundb   s     67;K({$;L6B&&3,<)J@DJ**00=.8+y)--o> ? * 87 ?> *) 87s<   BCC"B=$C,C=
CC
C	C
C-c                    UR                  S5       nUR                  5       n[        R                  " U5      nUS   nSoeU:H  ow(       do  [        R
                  " SU4SXV45      [        R                  " U5      [        R                  " U5      S.-  nSSU0-  n	[        [        R                  " U	5      5      eS	=n=pvUS
   nSoeU:H  ow(       do  [        R
                  " SU4SXV45      [        R                  " U5      [        R                  " U5      S.-  nSSU0-  n	[        [        R                  " U	5      5      eS	=n=pvSoUU;   ow(       d  [        R
                  " SU4SXT45      [        R                  " U5      S[        R                  " 5       ;   d  [        R                  " U5      (       a  [        R                  " U5      OSS.-  n
SSU
0-  n[        [        R                  " U5      5      eS	=pWSoTS   oeU;   ow(       do  [        R
                  " SU4SXV45      [        R                  " U5      [        R                  " U5      S.-  nSSU0-  n	[        [        R                  " U	5      5      eS	=n=pvSoTS   oeU;   ow(       do  [        R
                  " SU4SXV45      [        R                  " U5      [        R                  " U5      S.-  nSSU0-  n	[        [        R                  " U	5      5      eS	=n=pvUS   S   nSoeU:H  ow(       do  [        R
                  " SU4SXV45      [        R                  " U5      [        R                  " U5      S.-  nSSU0-  n	[        [        R                  " U	5      5      eS	=n=pvUS   S   nUS   nSoeU:H  ow(       do  [        R
                  " SU4SXV45      [        R                  " U5      [        R                  " U5      S.-  nSSU0-  n	[        [        R                  " U	5      5      eS	=n=pvUS   nSoeU:H  ow(       do  [        R
                  " SU4SXV45      [        R                  " U5      [        R                  " U5      S.-  nSSU0-  n	[        [        R                  " U	5      5      eS	=n=pvUS   S   n[        U5      nSoU:H  o(       d  [        R
                  " SU4SXn45      S[        R                  " 5       ;   d  [        R                  " [        5      (       a  [        R                  " [        5      OS[        R                  " U5      [        R                  " U5      [        R                  " U5      S.-  nSS U0-  n[        [        R                  " U5      5      eS	=n=n=pUS   S   S!   nUS"   nS#oeU:H  ow(       do  [        R
                  " SU4SXV45      [        R                  " U5      [        R                  " U5      S.-  nSSU0-  n	[        [        R                  " U	5      5      eS	=n=pvUS$   nS%oeU:H  ow(       do  [        R
                  " SU4SXV45      [        R                  " U5      [        R                  " U5      S.-  nSSU0-  n	[        [        R                  " U	5      5      eS	=n=pvS	S	S	5        g	! , (       d  f       g	= f)&z9Test that connecting to a valid race sends initial state./ws/races/42typeinitial_state==z%(py1)s == %(py4)spy1py4assert %(py6)spy6NrK   r   data)in)z%(py1)s in %(py3)smsg)rm   py3zassert %(py5)spy5race)z%(py1)s in %(py4)sr=   starter_countr   r5   r    r%   r   )z0%(py4)s
{%(py4)s = %(py0)s(%(py2)s)
} == %(py7)slen)py0py2rn   py7zassert %(py9)spy9r   r)   r   
horse_namer   )rb   receive_textjsonloads
@pytest_ar_call_reprcompare	_safereprAssertionError_format_explanation@py_builtinslocals_should_repr_global_namerx   )r>   r\   wsinitial_datars   @py_assert0@py_assert3@py_assert2@py_format5@py_format7@py_format4@py_format6	race_data@py_assert1@py_assert6@py_assert5@py_format8@py_format10starters                      rE   *test_websocket_connect_sends_initial_state8TestWebSocket.test_websocket_connect_sends_initial_states   s   %%n5??,L**\*Cv;1/1/11111;111;111/1111111y>'R'R'''''>'''>'''R''''''' S=    6   6      S    S       ([([(((((6(((6((([(((((((,V,,,,,,:,,,:,,,,,,,,,,v;/414144444/444/44414444444FF+I]+0q0q00000+000+000q0000000W%5555555%555%55555555556{:.43./414144444/444444344443444.444/44414444444&k*-a0G:&-#-#-----&---&---#-------<(8L8L88888(888(888L8888888% 655s   ZZ44
[c                 *   UR                  S5       nUR                  5         UR                  [        R                  " SSS.5      5        UR                  5       n[        R
                  " U5      nUS   nSoeU:H  ow(       do  [        R                  " SU4SXV45      [        R                  " U5      [        R                  " U5      S	.-  nS
SU0-  n	[        [        R                  " U	5      5      eS=n=pvUS   nSoeU:H  ow(       do  [        R                  " SU4SXV45      [        R                  " U5      [        R                  " U5      S	.-  nS
SU0-  n	[        [        R                  " U	5      5      eS=n=pvSSS5        g! , (       d  f       g= f)z,Test handling subscribe message from client.rf   	subscriber   rg   rK   rg   
subscribedri   rk   rl   ro   rp   NrK   )rb   r~   	send_textr   dumpsr   r   r   r   r   r   )
r>   r\   r   responsers   r   r   r   r   r   s
             rE    test_websocket_subscribe_message.TestWebSocket.test_websocket_subscribe_message   s    %%n5OO LL[R$HIJ (H**X&Cv;.,.,.....;...;...,.......y>'R'R'''''>'''>'''R''''''' 655s   E)F
Fc                 z    UR                  S5       nUR                  5         SSS5        g! , (       d  f       g= f)zBTest that disconnect removes client from race room without errors.rf   N)rb   r~   )r>   r\   r   s      rE   !test_websocket_disconnect_cleanup/TestWebSocket.test_websocket_disconnect_cleanup   s(    %%n5OO 655s   ,
:rJ   N)__name__
__module____qualname____firstlineno____doc__r_   fixturerD   r\   rc   r   r   r   __static_attributes__rJ   rG   rE   r   r      sH    4^^- -^ ^^" ">"9,(rG   r   c                      \ rS rSrSr\R                  R                  S 5       r\R                  R                  S 5       r	\R                  R                  S 5       r
\R                  R                  S 5       r\R                  R                  S 5       r\R                  R                  S 5       r\R                  R                  S	 5       r\R                  R                  S
 5       rSrg)TestConnectionManager   z!Unit tests for ConnectionManager.c                 P  #    [        5       n[        5       n[        5       Ul        [        5       Ul        UR                  US5      I Sh  vN   UR                  nSoC" U5      nSoeU:H  ow(       d  [        R                  " SU4SXV45      S[        R                  " 5       ;   d  [        R                  " U5      (       a  [        R                  " U5      OS[        R                  " U5      [        R                  " U5      [        R                  " U5      [        R                  " U5      S.-  nSSU0-  n	[        [        R                  " U	5      5      eS=n=n=n=pvUR                  R                  5         UR!                  US5      I Sh  vN   UR                  nSoC" U5      nS	oeU:H  ow(       d  [        R                  " SU4SXV45      S[        R                  " 5       ;   d  [        R                  " U5      (       a  [        R                  " U5      OS[        R                  " U5      [        R                  " U5      [        R                  " U5      [        R                  " U5      S.-  nSSU0-  n	[        [        R                  " U	5      5      eS=n=n=n=pvg GNV GN7f)
z#Test basic connect/disconnect flow.r   Nri   zZ%(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.get_connection_count
}(%(py4)s)
} == %(py9)scmry   rz   rn   rp   r|   assert %(py11)spy11r   )r
   r   r   acceptr   connectget_connection_countr   r   r   r   r   r   r   r   assert_awaited_once
disconnect)
r>   r   mock_wsr   r   r   @py_assert8@py_assert7r   @py_format12s
             rE   test_connect_and_disconnect1TestConnectionManager.test_connect_and_disconnect   s      &" Fjj!$$$&&.q.&q).Q.Q.....)......r....r...&...q...)...Q.......**,mmGQ'''&&.q.&q).Q.Q.....)......r....r...&...q...)...Q........ 	% 	(s&   AJ&
J EJ&J#DJ&#J&c                   #    [        5       n[        5       n[        5       Ul        [        5       Ul        [        5       n[        5       Ul        [        5       Ul        UR                  US5      I Sh  vN   UR                  US5      I Sh  vN   UR                  SS5      I Sh  vN   UR                  R                  S5        UR                  R                  S5        g No NW N?7f)z0Test broadcasting to all clients in a race room.r   N{"test": true})r
   r   r   r   r   r   broadcast_to_raceassert_called_once_withr>   r   ws1ws2s       rE   test_broadcast_to_race,TestConnectionManager.test_broadcast_to_race   s       f[
f[
jja   jja   ""#3Q777--.>?--.>? 	! 7s6   A0C(2C"3C(C$C(&C&'<C($C(&C(c                   #    [        5       n[        5       n[        5       Ul        [        5       Ul        [        5       n[        5       Ul        [        [        S5      S9Ul        UR                  US5      I Sh  vN   UR                  US5      I Sh  vN   UR                  SS5      I Sh  vN   UR                  R                  5         UR                  R                  5         g Nm NU N=7f)z2Test broadcast continues even if one client fails.zConnection lost)side_effectr   Nr   )	r
   r   r   r   r   ra   r   r   assert_called_oncer   s       rE   *test_broadcast_handles_disconnected_client@TestConnectionManager.test_broadcast_handles_disconnected_client   s       f[
f[
3D)EFjja   jja    ""#3Q777((*((* 	!  	8s6   A8C.:C(;C.C*C..C,/:C.*C.,C.c                 ^  #    [        5       nUR                  nSo2" U5      oD(       + oU(       d  SS[        R                  " 5       ;   d  [        R
                  " U5      (       a  [        R                  " U5      OS[        R                  " U5      [        R                  " U5      [        R                  " U5      S.-  n[        [        R                  " U5      5      eS=n=n=pEUR                  S5        UR                  nSo2" U5      oD(       d  SS[        R                  " 5       ;   d  [        R
                  " U5      (       a  [        R                  " U5      OS[        R                  " U5      [        R                  " U5      [        R                  " U5      S.-  n[        [        R                  " U5      5      eS=n=p4UR                  S5        UR                  nSo2" U5      oD(       + oU(       d  SS[        R                  " 5       ;   d  [        R
                  " U5      (       a  [        R                  " U5      OS[        R                  " U5      [        R                  " U5      [        R                  " U5      S.-  n[        [        R                  " U5      5      eS=n=n=pEg7f)z Test simulation task start/stop.r   [assert not %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.is_simulation_running
}(%(py4)s)
}r   ry   rz   rn   rp   NzWassert %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.is_simulation_running
}(%(py4)s)
})r
   rO   r   r   r   r   r   r   r   start_simulationstop_simulation)r>   r   r   r   r   r   r   r   s           rE   test_simulation_lifecycle/TestConnectionManager.test_simulation_lifecycle   s      ++.A.+A...........2....2...+...A..........
A''**'*********r****r***'*************
1++.A.+A...........2....2...+...A..........s   J+J-c                 	  #    [        5       n[        5       n[        5       Ul        [        5       n[        5       Ul        UR	                  US5      I Sh  vN   UR	                  US5      I Sh  vN   UR
                  nSoT" U5      nSovU:H  o(       d  [        R                  " SU4SXg45      S[        R                  " 5       ;   d  [        R                  " U5      (       a  [        R                  " U5      OS[        R                  " U5      [        R                  " U5      [        R                  " U5      [        R                  " U5      S.-  n	SS	U	0-  n
[        [        R                  " U
5      5      eS=n=n=n=pUR
                  nSoT" U5      nSovU:H  o(       d  [        R                  " SU4SXg45      S[        R                  " 5       ;   d  [        R                  " U5      (       a  [        R                  " U5      OS[        R                  " U5      [        R                  " U5      [        R                  " U5      [        R                  " U5      S.-  n	SS	U	0-  n
[        [        R                  " U
5      5      eS=n=n=n=pUR                  US5      I Sh  vN   UR
                  nSoT" U5      nS
ovU:H  o(       d  [        R                  " SU4SXg45      S[        R                  " 5       ;   d  [        R                  " U5      (       a  [        R                  " U5      OS[        R                  " U5      [        R                  " U5      [        R                  " U5      [        R                  " U5      S.-  n	SS	U	0-  n
[        [        R                  " U
5      5      eS=n=n=n=pUR
                  nSoT" U5      nSovU:H  o(       d  [        R                  " SU4SXg45      S[        R                  " 5       ;   d  [        R                  " U5      (       a  [        R                  " U5      OS[        R                  " U5      [        R                  " U5      [        R                  " U5      [        R                  " U5      S.-  n	SS	U	0-  n
[        [        R                  " U
5      5      eS=n=n=n=pg GNr GN[ GN(7f)z1Test connections to different races are isolated.r   Nr   ri   r   r   r   r   r   r   )r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r>   r   r   r   r   r   r   r   r   r   r   s              rE   test_multiple_race_rooms.TestConnectionManager.test_multiple_race_rooms   s      f[
f[
jja   jja   &&.q.&q).Q.Q.....)......r....r...&...q...)...Q.......&&.q.&q).Q.Q.....)......r....r...&...q...)...Q.......mmC###&&.q.&q).Q.Q.....)......r....r...&...q...)...Q.......&&.q.&q).Q.Q.....)......r....r...&...q...)...Q........ 	! 
 	$s8   ASSS.S	/H5S$S%H"S	SSc                    #    [        5       n[        5       n[        5       Ul        [        5       Ul        UR                  SU5      I Sh  vN   UR                  R                  S5        g N 7f)z,Test sending a message to a specific client.z{"hello": "world"}N)r
   r   r   r   r   send_personal_messager   )r>   r   r   s      rE   test_send_personal_message0TestConnectionManager.test_send_personal_message   s[       &" F&&';WEEE112FG 	Fs   AA-
A+!A-c                 X   #    [        5       nUR                  SS5      I Sh  vN   g N7f)z?Test broadcasting to a race with no connections does not error.r   i  N)r
   r   )r>   r   s     rE   "test_broadcast_to_nonexistent_race8TestConnectionManager.test_broadcast_to_nonexistent_race  s&       ""#3S999s    *(*c                   #    [        5       n[        5       n[        5       Ul        [        5       Ul        UR                  US5      I Sh  vN   UR                  S5        UR                  5       I Sh  vN   UR                  nSoC" U5      nSoeU:H  ow(       d  [        R                  " SU4SXV45      S[        R                  " 5       ;   d  [        R                  " U5      (       a  [        R                  " U5      OS[        R                  " U5      [        R                  " U5      [        R                  " U5      [        R                  " U5      S.-  nSS	U0-  n	[        [        R                   " U	5      5      eS=n=n=n=pvUR"                  nSoC" U5      oU(       + ow(       d  S
S[        R                  " 5       ;   d  [        R                  " U5      (       a  [        R                  " U5      OS[        R                  " U5      [        R                  " U5      [        R                  " U5      S.-  n
[        [        R                   " U
5      5      eS=n=n=pWg GN GN7f)z9Test close_all cleans up all connections and simulations.r   Nr   ri   r   r   r   r   r   r   r   )r
   r   r   r   closer   r   	close_allr   r   r   r   r   r   r   r   r   rO   )r>   r   r   r   r   r   r   r   r   r   r   s              rE   test_close_all$TestConnectionManager.test_close_all  sy      f[
K	jja   
Alln&&.q.&q).Q.Q.....)......r....r...&...q...)...Q.......++.A.+A...........2....2...+...A.......... 	! 	s%   AI$
I(I$3I!4G+I$!I$rJ   N)r   r   r   r   r   r_   markasyncior   r   r   r   r   r   r   r   r   rJ   rG   rE   r   r      s    +[[/ / [[@ @$ [[+ +& [[	/ 	/ [[/ /$ [[H H [[: : [[/ /rG   r   c                   *    \ rS rSrSrS rS rS rSrg)TestWebSocketMessageSchemasi  z,Tests for WebSocket message Pydantic models.c                    SSK Jn  U" SSSSSS./S	9n[        R                  " UR	                  5       5      nUS
   nSoTU:H  of(       do  [
        R                  " SU4SXE45      [
        R                  " U5      [
        R                  " U5      S.-  nSSU0-  n[        [
        R                  " U5      5      eS=n=peUS   nSoTU:H  of(       do  [
        R                  " SU4SXE45      [
        R                  " U5      [
        R                  " U5      S.-  nSSU0-  n[        [
        R                  " U5      5      eS=n=peUS   S   S   nSoTU:H  of(       do  [
        R                  " SU4SXE45      [
        R                  " U5      [
        R                  " U5      S.-  nSSU0-  n[        [
        R                  " U5      5      eS=n=peUS   S   S   nSoTU:H  of(       do  [
        R                  " SU4SXE45      [
        R                  " U5      [
        R                  " U5      S.-  nSSU0-  n[        [
        R                  " U5      5      eS=n=peg)z%Test OddsUpdateMessage serialization.r   )OddsUpdateMessageodds_updater   z2025-06-01T12:00:00r   g      @)r)   odds)rg   rK   	timestampr   rg   ri   rk   rl   ro   rp   NrK   r   r)   )
apps.backend.api.websocketr   r   r   model_dump_jsonr   r   r   r   r   )	r>   r   rs   rq   r   r   r   r   r   s	            rE   test_odds_update_message4TestWebSocketMessageSchemas.test_odds_update_message   s   @+ #./	
 zz#--/0F|,},},,,,,|,,,|,,,},,,,,,,I$"$"$$$$$$$$$$$"$$$$$$$F|Az*/a/a/////*///*///a///////F|Av&-#-#-----&---&---#-------rG   c           	         SSK Jn  U" SSSSSSS./S	9n[        R                  " UR	                  5       5      nUS
   nSoTU:H  of(       do  [
        R                  " SU4SXE45      [
        R                  " U5      [
        R                  " U5      S.-  nSSU0-  n[        [
        R                  " U5      5      eS=n=peUS   nSoTU:H  of(       do  [
        R                  " SU4SXE45      [
        R                  " U5      [
        R                  " U5      S.-  nSSU0-  n[        [
        R                  " U5      5      eS=n=peUS   S   S   nSoTU:H  of(       do  [
        R                  " SU4SXE45      [
        R                  " U5      [
        R                  " U5      S.-  nSSU0-  n[        [
        R                  " U5      5      eS=n=peg)z'Test ResultUpdateMessage serialization.r   )ResultUpdateMessageresult_updater   z2025-06-01T12:05:00r   T)r)   r/   finished)rg   rK   r   resultsrg   ri   rk   rl   ro   rp   NrK   r   r/   )
r   r   r   r   r   r   r   r   r   r   )	r>   r   rs   rq   r   r   r   r   r   s	            rE   test_result_update_message6TestWebSocketMessageSchemas.test_result_update_message0  s1   B! +"#tDE	
 zz#--/0F|.......|...|..........I$"$"$$$$$$$$$$$"$$$$$$$Iq!),1111111,111,1111111111rG   c                    SSK Jn  U" SSSS0S9nUR                  nSoCU:H  oU(       d  [        R                  " SU4S	X445      S
[
        R                  " 5       ;   d  [        R                  " U5      (       a  [        R                  " U5      OS
[        R                  " U5      [        R                  " U5      S.-  nSSU0-  n[        [        R                  " U5      5      eS=n=pTUR                  nSoCU:H  oU(       d  [        R                  " SU4SX445      S
[
        R                  " 5       ;   d  [        R                  " U5      (       a  [        R                  " U5      OS
[        R                  " U5      [        R                  " U5      S.-  nSSU0-  n[        [        R                  " U5      5      eS=n=pTUR                  nSS0oCU:H  oU(       d  [        R                  " SU4SX445      S
[
        R                  " 5       ;   d  [        R                  " U5      (       a  [        R                  " U5      OS
[        R                  " U5      [        R                  " U5      S.-  nSSU0-  n[        [        R                  " U5      5      eS=n=pTU" SSS9nUR                  nSoCUL oU(       d  [        R                  " SU4SX445      S[
        R                  " 5       ;   d  [        R                  " U5      (       a  [        R                  " U5      OS[        R                  " U5      [        R                  " U5      S.-  nSSU0-  n[        [        R                  " U5      5      eS=n=pTg)z!Test WSMessage schema validation.r   )	WSMessager   r   foobar)rg   rK   rq   ri   )z,%(py2)s
{%(py2)s = %(py0)s.type
} == %(py5)srs   )ry   rz   ru   zassert %(py7)sr{   N)z/%(py2)s
{%(py2)s = %(py0)s.race_id
} == %(py5)s)z,%(py2)s
{%(py2)s = %(py0)s.data
} == %(py5)spingr   r   )is)z,%(py2)s
{%(py2)s = %(py0)s.data
} is %(py5)smsg2)r   r   rg   r   r   r   r   r   r   r   r   rK   rq   )	r>   r   rs   r   @py_assert4r   r   r   r   s	            rE   test_ws_message_schema2TestWebSocketMessageSchemas.test_ws_message_schema?  s   8["E5>Jxx&;&;&&&&&x&&&&&&s&&&&s&&&x&&&;&&&&&&&{{ b b     {      s    s   {   b       xx)E5>)>)))))x))))))s))))s)))x)))>))))))) fa0yy D D     y      t    t   y   D       rG   rJ   N)	r   r   r   r   r   r   r   r  r   rJ   rG   rE   r   r     s    6. 2!rG   r   ) r   builtinsr   _pytest.assertion.rewrite	assertionrewriter   r   datetimer   unittest.mockr   r   r   r   r_   fastapi.testclientr   apps.backend.api.mainr	   r   r
   packages.core.storage.modelsr   r   r   r   r   r   r   r   r   rJ   rG   rE   <module>r     sN    9     ; ;  ) % 8 W WM Mfx/ x/v-! -!rG   