(
self, socket: MagicMock, getaddrinfo: MagicMock
)
| 902 | @patch("socket.getaddrinfo") |
| 903 | @patch("socket.socket") |
| 904 | def test_create_connection_with_scoped_ipv6( |
| 905 | self, socket: MagicMock, getaddrinfo: MagicMock |
| 906 | ) -> None: |
| 907 | # Check that providing create_connection with a scoped IPv6 address |
| 908 | # properly propagates the scope to getaddrinfo, and that the returned |
| 909 | # scoped ID makes it to the socket creation call. |
| 910 | fake_scoped_sa6 = ("a::b", 80, 0, 42) |
| 911 | getaddrinfo.return_value = [ |
| 912 | ( |
| 913 | socket.AF_INET6, |
| 914 | socket.SOCK_STREAM, |
| 915 | socket.IPPROTO_TCP, |
| 916 | "", |
| 917 | fake_scoped_sa6, |
| 918 | ) |
| 919 | ] |
| 920 | socket.return_value = fake_sock = MagicMock() |
| 921 | |
| 922 | create_connection(("a::b%iface", 80)) |
| 923 | assert getaddrinfo.call_args[0][0] == "a::b%iface" |
| 924 | fake_sock.connect.assert_called_once_with(fake_scoped_sa6) |
| 925 | |
| 926 | @pytest.mark.parametrize( |
| 927 | "input,params,expected", |
nothing calls this directly
no test coverage detected