def test_hostname_lookup_error(self) -> None:
"""
:meth:`.dns.Application.hostname` responds with a
:const:`twisted.web.http.NOT_FOUND` error if there is a DNS lookup
error.
"""
def getHostByName(*args, **kwargs) -> Deferred:
return fail(DNSLookupError())
self.patch(dns, "getHostByName", getHostByName)
self.assertResponse(
b"/gethostbyname/foo.example.com",
response_data=b"lookup error",
response_code=http.NOT_FOUND,
)
评论列表
文章目录