| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- from pathlib import Path
- from httphound.main import BaseProxyTest, ProxyConfig
- class FailHeaderBackendTest(BaseProxyTest):
- """A test to check the headers received by the backend.
- This test should fail
- """
- def __init__(self):
- super().__init__()
- self.description = "Backend headers check (Fail)"
- # We send an header but expect another one on the backend
- self.headers = {
- "X-Test-1": "1234",
- }
- self.expected_backend_headers = {
- "x-test-2": "abcd",
- }
- self.proxy_config = ProxyConfig(
- binary_path=Path.home() / "bin/haproxy"
- )
- async def run_test(self):
- await self.make_request()
- return True
- class PassHeaderBackendTest(BaseProxyTest):
- """A test to check the headers received by the backend.
- """
- def __init__(self):
- super().__init__()
- self.description = "Backend headers check (Pass)"
- self.headers = {
- "X-Test-1": "abcd",
- }
- self.expected_backend_headers = {
- "x-test-1": "abcd",
- }
- self.proxy_config = ProxyConfig(
- binary_path=Path.home() / "bin/haproxy"
- )
- async def run_test(self):
- await self.make_request()
- return True
|