| 12345678910111213141516171819202122232425262728293031323334353637 |
- from pathlib import Path
- from httphound.main import BaseProxyTest, ProxyConfig
- class ErroredTest(BaseProxyTest):
- """A test that raise an exception to demonstrate the difference
- between failed test and errored test
- """
- def __init__(self):
- super().__init__()
- self.description = "A test that produces an error (Error)"
- self.proxy_config = ProxyConfig(
- binary_path=Path.home() / "bin/haproxy"
- )
- async def run_test(self):
- await self.make_request()
- # This will fail with the standard error message
- return False
- class ErroredExceptionTest(BaseProxyTest):
- """Also raising an exception in run_test() produces an errored
- test
- """
- def __init__(self):
- super().__init__()
- self.description = "A test that produces an exception (Error)"
- self.proxy_config = ProxyConfig(
- binary_path=Path.home() / "bin/haproxy"
- )
- async def run_test(self):
- await self.make_request()
- # There's no need of returning bool here
- raise RuntimeError("This must fail with custom message")
|