This repository was archived by the owner on Nov 23, 2017. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -1463,18 +1463,23 @@ def test_create_datagram_endpoint_connect_err(self):
1463
1463
self .assertRaises (
1464
1464
OSError , self .loop .run_until_complete , coro )
1465
1465
1466
- def test_create_datagram_endpoint_no_connect_when_broadcast_allowed (self ):
1466
+ def test_create_datagram_endpoint_allow_broadcast (self ):
1467
+ protocol = MyDatagramProto (create_future = True , loop = self .loop )
1467
1468
self .loop .sock_connect = sock_connect = mock .Mock ()
1468
1469
sock_connect .return_value = []
1469
1470
1470
1471
coro = self .loop .create_datagram_endpoint (
1471
- asyncio . DatagramProtocol ,
1472
+ lambda : protocol ,
1472
1473
remote_addr = ('127.0.0.1' , 0 ),
1473
1474
allow_broadcast = True )
1474
1475
1475
- self .loop .run_until_complete (coro )
1476
+ transport , _ = self .loop .run_until_complete (coro )
1476
1477
self .assertFalse (sock_connect .called )
1477
1478
1479
+ transport .close ()
1480
+ self .loop .run_until_complete (protocol .done )
1481
+ self .assertEqual ('CLOSED' , protocol .state )
1482
+
1478
1483
@patch_socket
1479
1484
def test_create_datagram_endpoint_socket_err (self , m_socket ):
1480
1485
m_socket .getaddrinfo = socket .getaddrinfo
You can’t perform that action at this time.
0 commit comments