MCPcopy Index your code
hub / github.com/saltstack/salt / test_query_null_response

Function test_query_null_response

tests/pytests/unit/utils/test_http.py:204–218  ·  view source on GitHub ↗

This tests that we get a null response when raise_error=False and the host/port cannot be reached.

()

Source from the content-addressed store, hash-verified

202
203@pytest.mark.slow_test
204def 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
221def test_query_error_handling():

Callers

nothing calls this directly

Calls 1

queryMethod · 0.80

Tested by

no test coverage detected