Commit Graph

6 Commits

Author SHA1 Message Date
Takeshi KOMIYA
b615fcca85
Merge pull request #8436 from francoisfreitag/better-certs
linkcheck: Specify subjectAltName in test self-signed certificate
2020-11-16 02:42:34 +09:00
François Freitag
3c4e1c30b1
linkcheck: Specify subjectAltName in test self-signed certificate
Clears warning:

tests/test_build_linkcheck.py::test_connect_to_selfsigned_with_tls_cacerts
tests/test_build_linkcheck.py::test_connect_to_selfsigned_with_requests_env_var
  …/venv/lib/python3.8/site-packages/urllib3/connection.py:455: SubjectAltNameWarning: Certificate for localhost has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)
    warnings.warn(
2020-11-15 18:25:39 +01:00
François Freitag
5eb74d5c8e
tests: Always cleanup when exiting modify_env context manager
Previously, an exception would leave the environment changed.
2020-11-15 10:25:36 +01:00
François Freitag
d453088b58
linkcheck: Prevent REQUESTS_CA_BUNDLE leak in tests
Test `test_connect_to_selfsigned_nonexistent_cert_file` serves two
purposes:
- verify the behavior when the CA bundle file path is incorrect
- flag a leak of REQUESTS_CA_BUNDLE

Assumes that test runs after
`test_connect_to_selfsigned_with_requests_env_var`. Not great, but
better than no testing.
2020-11-14 19:58:02 +01:00
François Freitag
10e11f3133
linkcheck: Verify behavior with self-signed certs 2020-11-14 12:59:29 +01:00
François Freitag
0178437f3c
Rewrite test_inspect_main_url to avoid mocking
Makes the test more realistic by issuing an HTTP request.
Reduces coupling between test and the code under test.

The `http_server` helper was factored out into a new tests.utils module.
2020-11-08 22:30:49 +01:00