def test__getPort_calls__listenUDP_with_args_from_constructor(self): server = UDPServer(sentinel.foo, bar=sentinel.bar) _listenUDP = self.patch(server, "_listenUDP") _listenUDP.return_value = sentinel.port self.assertEqual(sentinel.port, server._getPort()) self.assertThat(_listenUDP, MockCalledOnceWith(sentinel.foo, bar=sentinel.bar))
def test_listenUDP_with_IPv6_address(self): server = UDPServer(0, DummyProtocol(), "::1") port = server._getPort() self.addCleanup(port.stopListening) self.assertEqual(AF_INET6, port.addressFamily)