mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-09-30 00:01:02 -04:00
reenabled timeout tests again
This commit is contained in:
parent
327e8f014f
commit
89fde80f10
@ -49,25 +49,22 @@ class SessionTest < Minitest::Test
|
||||
assert body.foo == "response-body-foo", "response body method is unexpected"
|
||||
end
|
||||
|
||||
# def test_session_timeouts_total_timeout
|
||||
# uri = build_uri("/delay/3")
|
||||
# session = HTTPX.timeout(operation_timeout: 1, total_timeout: 2)
|
||||
# response = session.get(uri)
|
||||
# assert response.is_a?(HTTPX::ErrorResponse), "response should have failed"
|
||||
# assert response.status =~ /timed out after \d+ seconds/i, "response should have timed out"
|
||||
# end
|
||||
def test_session_timeouts_total_timeout
|
||||
uri = build_uri("/delay/3")
|
||||
session = HTTPX.with_timeout(operation_timeout: 1, total_timeout: 2)
|
||||
response = session.get(uri)
|
||||
assert response.is_a?(HTTPX::ErrorResponse), "response should have failed"
|
||||
assert response.status =~ /timed out after \d+ seconds/i, "response should have timed out"
|
||||
end
|
||||
|
||||
# if ENV.key?("HTTPX_DEBUG")
|
||||
# def test_session_timeout_connect_timeout
|
||||
# sleep 2
|
||||
# uri = build_uri("/", origin("127.0.0.1:#{CONNECT_TIMEOUT_PORT}"))
|
||||
# session = HTTPX.with_timeout(connect_timeout: 0.5, operation_timeout: 30, total_timeout: 2)
|
||||
# response = session.get(uri)
|
||||
# assert response.is_a?(HTTPX::ErrorResponse), "response should have failed (#{response.class})"
|
||||
# assert response.error.is_a?(HTTPX::ConnectTimeoutError),
|
||||
# "response should have failed on connection (#{response.error.class}: #{response.error})"
|
||||
# end
|
||||
# end
|
||||
def test_session_timeout_connect_timeout
|
||||
uri = build_uri("/", origin("127.0.0.1:#{CONNECT_TIMEOUT_PORT}"))
|
||||
session = HTTPX.with_timeout(connect_timeout: 0.5, operation_timeout: 30, total_timeout: 2)
|
||||
response = session.get(uri)
|
||||
assert response.is_a?(HTTPX::ErrorResponse), "response should have failed (#{response.class})"
|
||||
assert response.error.is_a?(HTTPX::ConnectTimeoutError),
|
||||
"response should have failed on connection (#{response.error.class}: #{response.error})"
|
||||
end
|
||||
|
||||
# def test_http_timeouts_operation_timeout
|
||||
# uri = build_uri("/delay/2")
|
||||
|
Loading…
x
Reference in New Issue
Block a user