Use new private variable for hostname as str

`._hostStr` was replaced with `._hostText` in https://github.com/twisted/twisted/pull/12351

Resolves the following errors:

tests/http/test_proxyagent.py:857: error: "HostnameEndpoint" has no attribute "_hostStr"  [attr-defined]
tests/http/test_proxyagent.py:869: error: "HostnameEndpoint" has no attribute "_hostStr"  [attr-defined]
This commit is contained in:
Andrew Morgan 2024-12-04 18:36:51 +00:00
parent c2dea135f5
commit e5869f7f5f

View file

@ -854,7 +854,7 @@ class MatrixFederationAgentTests(TestCase):
def test_proxy_with_no_scheme(self) -> None:
http_proxy_agent = ProxyAgent(self.reactor, use_proxy=True)
proxy_ep = checked_cast(HostnameEndpoint, http_proxy_agent.http_proxy_endpoint)
self.assertEqual(proxy_ep._hostStr, "proxy.com")
self.assertEqual(proxy_ep._hostText, "proxy.com")
self.assertEqual(proxy_ep._port, 8888)
@patch.dict(os.environ, {"http_proxy": "socks://proxy.com:8888"})
@ -866,14 +866,14 @@ class MatrixFederationAgentTests(TestCase):
def test_proxy_with_http_scheme(self) -> None:
http_proxy_agent = ProxyAgent(self.reactor, use_proxy=True)
proxy_ep = checked_cast(HostnameEndpoint, http_proxy_agent.http_proxy_endpoint)
self.assertEqual(proxy_ep._hostStr, "proxy.com")
self.assertEqual(proxy_ep._hostText, "proxy.com")
self.assertEqual(proxy_ep._port, 8888)
@patch.dict(os.environ, {"http_proxy": "https://proxy.com:8888"})
def test_proxy_with_https_scheme(self) -> None:
https_proxy_agent = ProxyAgent(self.reactor, use_proxy=True)
proxy_ep = checked_cast(_WrapperEndpoint, https_proxy_agent.http_proxy_endpoint)
self.assertEqual(proxy_ep._wrappedEndpoint._hostStr, "proxy.com")
self.assertEqual(proxy_ep._wrappedEndpoint._hostText, "proxy.com")
self.assertEqual(proxy_ep._wrappedEndpoint._port, 8888)