Commit 6578a95f authored by juga's avatar juga
Browse files

tests: Add test to check get/head timeout

Closes: #29551. Bugfix 1.0.3-dev0.
parent 1cc8351c
"""Integration tests for requests."""
import requests
import uuid
from sbws import settings
from sbws.util import requests as requests_utils
def test_make_session(conf, persistent_launch_tor, dests):
uuid_str = str(uuid.uuid4())
settings.init_http_headers(conf.get('scanner', 'nickname'), uuid_str,
session = requests_utils.make_session(
persistent_launch_tor, conf.getfloat('general', 'http_timeout'))
assert session._timeout == conf.getfloat('general', 'http_timeout')
# Because there is not an stream attached to a circuit, this will timeout.
response = None
response = session.get(, verify=False)
except requests.exceptions.ConnectTimeout:
assert response is None
# Disable socks proxies to test a session request not over Tor
# without timeout.
session.proxies = {}
response = session.get(, verify=False)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment