test_config.py
This file
Path
tests/test_config.py
133 lines · 4.0 KiB · Python
Last changed by
Accept SSLContext into SSLConfig(verify=...) (#215)Seth Michael Larsonbefore adoptiondf8874b
History of this fileTake it
The walk stopped after 200 commits: lines older than bb3d452 point at it.
Finessing interfaceTom Christiebefore adoptiond7619a9
lines 1–4why, one step back1import ssl23import pytest4Renaming -> httpx (#129)Tom Christiebefore adoption2d09d5b
line 5why, one step back5import httpxFinessing interfaceTom Christiebefore adoptiond7619a9
lines 6–7why, one step back67Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6
line 8why, one step back8def test_load_ssl_config():Renaming -> httpx (#129)Tom Christiebefore adoption2d09d5b
line 9why, one step back9 ssl_config = httpx.SSLConfig()Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6
line 10why, one step back10 context = ssl_config.load_ssl_context()Finessing interfaceTom Christiebefore adoptiond7619a9
line 11why, one step back11 assert context.verify_mode == ssl.VerifyMode.CERT_REQUIREDSupport client cert passwords, new TLS options (#118)Seth Michael Larsonbefore adoptionba83e29
line 12why, one step back12 assert context.check_hostname is TrueMerge pull request #61 from yeraydiazdiaz/test-configTom Christiebefore adoptionabec2e8
lines 13–14why, one step back1314Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6
line 15why, one step back15def test_load_ssl_config_verify_non_existing_path():Renaming -> httpx (#129)Tom Christiebefore adoption2d09d5b
line 16why, one step back16 ssl_config = httpx.SSLConfig(verify="/path/to/nowhere")Merge pull request #61 from yeraydiazdiaz/test-configTom Christiebefore adoptionabec2e8
line 17why, one step back17 with pytest.raises(IOError):Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6
line 18why, one step back18 ssl_config.load_ssl_context()Merge pull request #61 from yeraydiazdiaz/test-configTom Christiebefore adoptionabec2e8
lines 19–20why, one step back1920Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6
line 21why, one step back21def test_load_ssl_config_verify_existing_file():Renaming -> httpx (#129)Tom Christiebefore adoption2d09d5b
line 22why, one step back22 ssl_config = httpx.SSLConfig(verify=httpx.config.DEFAULT_CA_BUNDLE_PATH)Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6
line 23why, one step back23 context = ssl_config.load_ssl_context()Merge pull request #61 from yeraydiazdiaz/test-configTom Christiebefore adoptionabec2e8
line 24why, one step back24 assert context.verify_mode == ssl.VerifyMode.CERT_REQUIREDSupport client cert passwords, new TLS options (#118)Seth Michael Larsonbefore adoptionba83e29
line 25why, one step back25 assert context.check_hostname is TrueMerge pull request #61 from yeraydiazdiaz/test-configTom Christiebefore adoptionabec2e8
lines 26–27why, one step back2627Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6
line 28why, one step back28def test_load_ssl_config_verify_directory():Use pathlib.Path instead of os.path functions (#188)Stephen Brown IIbefore adoptionfde30b8
line 29why, one step back29 path = httpx.config.DEFAULT_CA_BUNDLE_PATH.parentRenaming -> httpx (#129)Tom Christiebefore adoption2d09d5b
line 30why, one step back30 ssl_config = httpx.SSLConfig(verify=path)Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6
line 31why, one step back31 context = ssl_config.load_ssl_context()Merge pull request #61 from yeraydiazdiaz/test-configTom Christiebefore adoptionabec2e8
line 32why, one step back32 assert context.verify_mode == ssl.VerifyMode.CERT_REQUIREDSupport client cert passwords, new TLS options (#118)Seth Michael Larsonbefore adoptionba83e29
line 33why, one step back33 assert context.check_hostname is TrueMerge pull request #61 from yeraydiazdiaz/test-configTom Christiebefore adoptionabec2e8
lines 34–35why, one step back3435Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6
line 36why, one step back36def test_load_ssl_config_cert_and_key(cert_pem_file, cert_private_key_file):Renaming -> httpx (#129)Tom Christiebefore adoption2d09d5b
line 37why, one step back37 ssl_config = httpx.SSLConfig(cert=(cert_pem_file, cert_private_key_file))Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6
line 38why, one step back38 context = ssl_config.load_ssl_context()Merge pull request #61 from yeraydiazdiaz/test-configTom Christiebefore adoptionabec2e8
line 39why, one step back39 assert context.verify_mode == ssl.VerifyMode.CERT_REQUIREDSupport client cert passwords, new TLS options (#118)Seth Michael Larsonbefore adoptionba83e29
line 40why, one step back40 assert context.check_hostname is TrueMerge pull request #61 from yeraydiazdiaz/test-configTom Christiebefore adoptionabec2e8
lines 41–42why, one step back4142Support client cert passwords, new TLS options (#118)Seth Michael Larsonbefore adoptionba83e29
line 43why, one step back43@pytest.mark.parametrize("password", [b"password", "password"])Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6
line 44why, one step back44def test_load_ssl_config_cert_and_encrypted_key(Support client cert passwords, new TLS options (#118)Seth Michael Larsonbefore adoptionba83e29
lines 45–46why, one step back45 cert_pem_file, cert_encrypted_private_key_file, password46):Renaming -> httpx (#129)Tom Christiebefore adoption2d09d5b
line 47why, one step back47 ssl_config = httpx.SSLConfig(Support client cert passwords, new TLS options (#118)Seth Michael Larsonbefore adoptionba83e29
lines 48–49why, one step back48 cert=(cert_pem_file, cert_encrypted_private_key_file, password)49 )Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6
line 50why, one step back50 context = ssl_config.load_ssl_context()Support client cert passwords, new TLS options (#118)Seth Michael Larsonbefore adoptionba83e29
lines 51–54why, one step back51 assert context.verify_mode == ssl.VerifyMode.CERT_REQUIRED52 assert context.check_hostname is True5354Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6
line 55why, one step back55def test_load_ssl_config_cert_and_key_invalid_password(Support client cert passwords, new TLS options (#118)Seth Michael Larsonbefore adoptionba83e29
lines 56–57why, one step back56 cert_pem_file, cert_encrypted_private_key_file57):Renaming -> httpx (#129)Tom Christiebefore adoption2d09d5b
line 58why, one step back58 ssl_config = httpx.SSLConfig(Support client cert passwords, new TLS options (#118)Seth Michael Larsonbefore adoptionba83e29
lines 59–61why, one step back59 cert=(cert_pem_file, cert_encrypted_private_key_file, "password1")60 )61Merge pull request #61 from yeraydiazdiaz/test-configTom Christiebefore adoptionabec2e8
line 62why, one step back62 with pytest.raises(ssl.SSLError):Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6
line 63why, one step back63 ssl_config.load_ssl_context()Finessing interfaceTom Christiebefore adoptiond7619a9
lines 64–65why, one step back6465Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6
line 66why, one step back66def test_load_ssl_config_cert_without_key_raises(cert_pem_file):Renaming -> httpx (#129)Tom Christiebefore adoption2d09d5b
line 67why, one step back67 ssl_config = httpx.SSLConfig(cert=cert_pem_file)Support client cert passwords, new TLS options (#118)Seth Michael Larsonbefore adoptionba83e29
line 68why, one step back68 with pytest.raises(ssl.SSLError):Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6
line 69why, one step back69 ssl_config.load_ssl_context()Support client cert passwords, new TLS options (#118)Seth Michael Larsonbefore adoptionba83e29
lines 70–71why, one step back7071Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6
line 72why, one step back72def test_load_ssl_config_no_verify():Renaming -> httpx (#129)Tom Christiebefore adoption2d09d5b
line 73why, one step back73 ssl_config = httpx.SSLConfig(verify=False)Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6
line 74why, one step back74 context = ssl_config.load_ssl_context()Finessing interfaceTom Christiebefore adoptiond7619a9
line 75why, one step back75 assert context.verify_mode == ssl.VerifyMode.CERT_NONESupport client cert passwords, new TLS options (#118)Seth Michael Larsonbefore adoptionba83e29
line 76why, one step back76 assert context.check_hostname is FalseUpdate README for 0.2.0Tom Christiebefore adoptionbb3d452
lines 77–78why, one step back7778Accept SSLContext into SSLConfig(verify=...) (#215)Seth Michael Larsonbefore adoptiondf8874b
lines 79–87why, one step back79def test_load_ssl_context():80 ssl_context = ssl.create_default_context()81 ssl_config = httpx.SSLConfig(verify=ssl_context)8283 assert ssl_config.verify is True84 assert ssl_config.ssl_context is ssl_context85 assert repr(ssl_config) == "SSLConfig(cert=None, verify=True)"8687Update README for 0.2.0Tom Christiebefore adoptionbb3d452
line 88why, one step back88def test_ssl_repr():Renaming -> httpx (#129)Tom Christiebefore adoption2d09d5b
line 89why, one step back89 ssl = httpx.SSLConfig(verify=False)Update README for 0.2.0Tom Christiebefore adoptionbb3d452
lines 90–93why, one step back90 assert repr(ssl) == "SSLConfig(cert=None, verify=False)"919293def test_timeout_repr():Renaming -> httpx (#129)Tom Christiebefore adoption2d09d5b
line 94why, one step back94 timeout = httpx.TimeoutConfig(timeout=5.0)Update README for 0.2.0Tom Christiebefore adoptionbb3d452
lines 95–96why, one step back95 assert repr(timeout) == "TimeoutConfig(timeout=5.0)"96Renaming -> httpx (#129)Tom Christiebefore adoption2d09d5b
line 97why, one step back97 timeout = httpx.TimeoutConfig(read_timeout=5.0)Update README for 0.2.0Tom Christiebefore adoptionbb3d452
lines 98–99why, one step back98 assert (99 repr(timeout)Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
line 100why, one step back100 == "TimeoutConfig(connect_timeout=None, read_timeout=5.0, write_timeout=None)"Update README for 0.2.0Tom Christiebefore adoptionbb3d452
lines 101–104why, one step back101 )102103104def test_limits_repr():Renaming -> httpx (#129)Tom Christiebefore adoption2d09d5b
line 105why, one step back105 limits = httpx.PoolLimits(hard_limit=100)Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
lines 106–108why, one step back106 assert (107 repr(limits) == "PoolLimits(soft_limit=None, hard_limit=100, pool_timeout=None)"108 )Update README for 0.2.0Tom Christiebefore adoptionbb3d452
lines 109–111why, one step back109110111def test_ssl_eq():Renaming -> httpx (#129)Tom Christiebefore adoption2d09d5b
lines 112–113why, one step back112 ssl = httpx.SSLConfig(verify=False)113 assert ssl == httpx.SSLConfig(verify=False)Update README for 0.2.0Tom Christiebefore adoptionbb3d452
lines 114–116why, one step back114115116def test_timeout_eq():Renaming -> httpx (#129)Tom Christiebefore adoption2d09d5b
lines 117–118why, one step back117 timeout = httpx.TimeoutConfig(timeout=5.0)118 assert timeout == httpx.TimeoutConfig(timeout=5.0)Update README for 0.2.0Tom Christiebefore adoptionbb3d452
lines 119–121why, one step back119120121def test_limits_eq():Renaming -> httpx (#129)Tom Christiebefore adoption2d09d5b
lines 122–123why, one step back122 limits = httpx.PoolLimits(hard_limit=100)123 assert limits == httpx.PoolLimits(hard_limit=100)Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 124–126why, one step back124125126def test_timeout_from_tuple():Renaming -> httpx (#129)Tom Christiebefore adoption2d09d5b
lines 127–128why, one step back127 timeout = httpx.TimeoutConfig(timeout=(5.0, 5.0, 5.0))128 assert timeout == httpx.TimeoutConfig(timeout=5.0)Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 129–131why, one step back129130131def test_timeout_from_config_instance():Renaming -> httpx (#129)Tom Christiebefore adoption2d09d5b
lines 132–133why, one step back132 timeout = httpx.TimeoutConfig(timeout=5.0)133 assert httpx.TimeoutConfig(timeout) == httpx.TimeoutConfig(timeout=5.0)