@@ -429,7 +429,8 @@ def test_handle_connect_rejected(self, eio):
429429        _run (s ._handle_eio_message ('123' , '0' ))
430430        assert  not  s .manager .is_connected ('1' , '/foo' )
431431        handler .assert_called_once_with ('1' , 'environ' )
432-         s .eio .send .mock .assert_called_once_with ('123' , '4' )
432+         s .eio .send .mock .assert_called_once_with (
433+             '123' , '4{"message":"Connection rejected by server"}' )
433434        assert  s .environ  ==  {'123' : 'environ' }
434435
435436    def  test_handle_connect_namespace_rejected (self , eio ):
@@ -441,7 +442,8 @@ def test_handle_connect_namespace_rejected(self, eio):
441442        _run (s ._handle_eio_message ('123' , '0/foo' ))
442443        assert  not  s .manager .is_connected ('1' , '/foo' )
443444        handler .assert_called_once_with ('1' , 'environ' )
444-         s .eio .send .mock .assert_any_call ('123' , '4/foo' )
445+         s .eio .send .mock .assert_any_call (
446+             '123' , '4/foo,{"message":"Connection rejected by server"}' )
445447        assert  s .environ  ==  {'123' : 'environ' }
446448
447449    def  test_handle_connect_rejected_always_connect (self , eio ):
@@ -454,7 +456,8 @@ def test_handle_connect_rejected_always_connect(self, eio):
454456        assert  not  s .manager .is_connected ('1' , '/' )
455457        handler .assert_called_once_with ('1' , 'environ' )
456458        s .eio .send .mock .assert_any_call ('123' , '0{"sid":"1"}' )
457-         s .eio .send .mock .assert_any_call ('123' , '1' )
459+         s .eio .send .mock .assert_any_call (
460+             '123' , '1{"message":"Connection rejected by server"}' )
458461        assert  s .environ  ==  {'123' : 'environ' }
459462
460463    def  test_handle_connect_namespace_rejected_always_connect (self , eio ):
@@ -467,7 +470,8 @@ def test_handle_connect_namespace_rejected_always_connect(self, eio):
467470        assert  not  s .manager .is_connected ('1' , '/foo' )
468471        handler .assert_called_once_with ('1' , 'environ' )
469472        s .eio .send .mock .assert_any_call ('123' , '0/foo,{"sid":"1"}' )
470-         s .eio .send .mock .assert_any_call ('123' , '1/foo' )
473+         s .eio .send .mock .assert_any_call (
474+             '123' , '1/foo,{"message":"Connection rejected by server"}' )
471475        assert  s .environ  ==  {'123' : 'environ' }
472476
473477    def  test_handle_connect_rejected_with_exception (self , eio ):
@@ -481,7 +485,8 @@ def test_handle_connect_rejected_with_exception(self, eio):
481485        _run (s ._handle_eio_message ('123' , '0' ))
482486        assert  not  s .manager .is_connected ('1' , '/' )
483487        handler .assert_called_once_with ('1' , 'environ' )
484-         s .eio .send .mock .assert_called_once_with ('123' , '4"fail_reason"' )
488+         s .eio .send .mock .assert_called_once_with (
489+             '123' , '4{"message":"fail_reason"}' )
485490        assert  s .environ  ==  {'123' : 'environ' }
486491
487492    def  test_handle_connect_rejected_with_empty_exception (self , eio ):
@@ -495,22 +500,24 @@ def test_handle_connect_rejected_with_empty_exception(self, eio):
495500        _run (s ._handle_eio_message ('123' , '0' ))
496501        assert  not  s .manager .is_connected ('1' , '/' )
497502        handler .assert_called_once_with ('1' , 'environ' )
498-         s .eio .send .mock .assert_called_once_with ('123' , '4' )
503+         s .eio .send .mock .assert_called_once_with (
504+             '123' , '4{"message":"Connection rejected by server"}' )
499505        assert  s .environ  ==  {'123' : 'environ' }
500506
501507    def  test_handle_connect_namespace_rejected_with_exception (self , eio ):
502508        eio .return_value .send  =  AsyncMock ()
503509        s  =  asyncio_server .AsyncServer ()
504510        handler  =  mock .MagicMock (
505-             side_effect = exceptions .ConnectionRefusedError ('fail_reason' , 1 )
511+             side_effect = exceptions .ConnectionRefusedError (
512+                 'fail_reason' , 1 , '2' )
506513        )
507514        s .on ('connect' , handler , namespace = '/foo' )
508515        _run (s ._handle_eio_connect ('123' , 'environ' ))
509516        _run (s ._handle_eio_message ('123' , '0/foo' ))
510517        assert  not  s .manager .is_connected ('1' , '/foo' )
511518        handler .assert_called_once_with ('1' , 'environ' )
512-         s .eio .send .mock .assert_called_once_with ('123' , 
513-                                                  '4/foo,[" fail_reason",1] ' )
519+         s .eio .send .mock .assert_called_once_with (
520+             '123' ,  '4/foo,{"message":" fail_reason","data":[1,"2"]} ' )
514521        assert  s .environ  ==  {'123' : 'environ' }
515522
516523    def  test_handle_connect_namespace_rejected_with_empty_exception (self , eio ):
@@ -524,7 +531,8 @@ def test_handle_connect_namespace_rejected_with_empty_exception(self, eio):
524531        _run (s ._handle_eio_message ('123' , '0/foo' ))
525532        assert  not  s .manager .is_connected ('1' , '/foo' )
526533        handler .assert_called_once_with ('1' , 'environ' )
527-         s .eio .send .mock .assert_called_once_with ('123' , '4/foo' )
534+         s .eio .send .mock .assert_called_once_with (
535+             '123' , '4/foo,{"message":"Connection rejected by server"}' )
528536        assert  s .environ  ==  {'123' : 'environ' }
529537
530538    def  test_handle_disconnect (self , eio ):
0 commit comments