Home / Function/ test_https_warnings() — requests Function Reference

test_https_warnings() — requests Function Reference

Architecture documentation for the test_https_warnings() function in test_requests.py from the requests codebase.

Entity Profile

Dependency Diagram

graph TD
  ad5b1435_6ef4_6e00_58ee_c298e531e348["test_https_warnings()"]
  22b80b19_26d4_cd0e_c476_3edf87b3df14["TestRequests"]
  ad5b1435_6ef4_6e00_58ee_c298e531e348 -->|defined in| 22b80b19_26d4_cd0e_c476_3edf87b3df14
  style ad5b1435_6ef4_6e00_58ee_c298e531e348 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_requests.py lines 1026–1049

    def test_https_warnings(self, nosan_server):
        """warnings are emitted with requests.get"""
        host, port, ca_bundle = nosan_server
        if HAS_MODERN_SSL or HAS_PYOPENSSL:
            warnings_expected = ("SubjectAltNameWarning",)
        else:
            warnings_expected = (
                "SNIMissingWarning",
                "InsecurePlatformWarning",
                "SubjectAltNameWarning",
            )

        with pytest.warns() as warning_records:
            warnings.simplefilter("always")
            requests.get(f"https://localhost:{port}/", verify=ca_bundle)

        warning_records = [
            item
            for item in warning_records
            if item.category.__name__ != "ResourceWarning"
        ]

        warnings_category = tuple(item.category.__name__ for item in warning_records)
        assert warnings_category == warnings_expected

Domain

Subdomains

Frequently Asked Questions

What does test_https_warnings() do?
test_https_warnings() is a function in the requests codebase, defined in tests/test_requests.py.
Where is test_https_warnings() defined?
test_https_warnings() is defined in tests/test_requests.py at line 1026.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free