| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- from pathlib import Path
- from httphound.main import BaseProxyTest, BackendConfig, ProxyConfig
- class FailExampleMultipleFailTest(BaseProxyTest):
- """A simple test to demonstrate multiple failures
- """
- def __init__(self):
- super().__init__()
- self.description = "Example multiple failures (Fail)"
- self.backend_config = BackendConfig(
- # Response headers, body and status are sent to the reverse proxy
- # at each request
- response_headers={
- "X-Test-1": "1234",
- "X-Test-2": "5678",
- },
- response_body="This is just a test body",
- response_status=301,
- )
- # This should fail
- self.expected_headers = {
- "x-test-2": "42",
- }
- # This should fail
- self.expected_status = 200
- # This should pass
- self.forbidden_client_headers = {
- "x-test-3": "abcd",
- }
- self.proxy_config = ProxyConfig(
- binary_path=Path.home() / "bin/haproxy"
- )
- async def run_test(self):
- await self.make_request()
- return True
|