1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
"""Integration tests for requests."""
import uuid
import requests
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,
str(persistent_launch_tor.get_version()),
)
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
try:
response = session.get(dests.next().url, verify=False)
except requests.exceptions.ConnectTimeout:
pass
assert response is None
|