SERVER_PORT is populated correctly from the requested URL.
(url: str, expected_server_port: str)
| 166 | ], |
| 167 | ) |
| 168 | def test_wsgi_server_port(url: str, expected_server_port: str) -> None: |
| 169 | """ |
| 170 | SERVER_PORT is populated correctly from the requested URL. |
| 171 | """ |
| 172 | hello_world_app = application_factory([b"Hello, World!"]) |
| 173 | server_port: str | None = None |
| 174 | |
| 175 | def app(environ, start_response): |
| 176 | nonlocal server_port |
| 177 | server_port = environ["SERVER_PORT"] |
| 178 | return hello_world_app(environ, start_response) |
| 179 | |
| 180 | transport = httpx.WSGITransport(app=app) |
| 181 | client = httpx.Client(transport=transport) |
| 182 | response = client.get(url) |
| 183 | assert response.status_code == 200 |
| 184 | assert response.text == "Hello, World!" |
| 185 | assert server_port == expected_server_port |
| 186 | |
| 187 | |
| 188 | def test_wsgi_server_protocol(): |
nothing calls this directly
no test coverage detected