This tests that we get a null response when raise_error=False and the host/port cannot be reached.
()
| 202 | |
| 203 | @pytest.mark.slow_test |
| 204 | def test_query_null_response(): |
| 205 | """ |
| 206 | This tests that we get a null response when raise_error=False and the |
| 207 | host/port cannot be reached. |
| 208 | """ |
| 209 | host = "127.0.0.1" |
| 210 | |
| 211 | port = ports.get_unused_localhost_port() |
| 212 | |
| 213 | url = f"http://{host}:{port}/" |
| 214 | result = http.query(url, raise_error=False) |
| 215 | if sys.platform.startswith("win"): |
| 216 | assert result == {"error": "[Errno 10061] Unknown error"}, result |
| 217 | else: |
| 218 | assert result == {"error": "[Errno 111] Connection refused"} |
| 219 | |
| 220 | |
| 221 | def test_query_error_handling(): |