MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_networked

Method test_networked

Lib/test/test_httplib.py:2019–2027  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2017 self.assertEqual(h.timeout, 30)
2018
2019 def test_networked(self):
2020 # Default settings: requires a valid cert from a trusted CA
2021 import ssl
2022 support.requires('network')
2023 with socket_helper.transient_internet('self-signed.pythontest.net'):
2024 h = client.HTTPSConnection('self-signed.pythontest.net', 443)
2025 with self.assertRaises(ssl.SSLError) as exc_info:
2026 h.request('GET', '/')
2027 self.assertEqual(exc_info.exception.reason, 'CERTIFICATE_VERIFY_FAILED')
2028
2029 def test_networked_noverification(self):
2030 # Switch off cert verification

Callers

nothing calls this directly

Calls 4

requiresMethod · 0.80
assertRaisesMethod · 0.45
requestMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected