(server)
| 143 | |
| 144 | |
| 145 | def test_auth(server): |
| 146 | url = str(server.url) |
| 147 | runner = CliRunner() |
| 148 | result = runner.invoke(httpx.main, [url, "-v", "--auth", "username", "password"]) |
| 149 | print(result.output) |
| 150 | assert result.exit_code == 0 |
| 151 | assert remove_date_header(splitlines(result.output)) == [ |
| 152 | "* Connecting to '127.0.0.1'", |
| 153 | "* Connected to '127.0.0.1' on port 8000", |
| 154 | "GET / HTTP/1.1", |
| 155 | f"Host: {server.url.netloc.decode('ascii')}", |
| 156 | "Accept: */*", |
| 157 | "Accept-Encoding: gzip, deflate, br, zstd", |
| 158 | "Connection: keep-alive", |
| 159 | f"User-Agent: python-httpx/{httpx.__version__}", |
| 160 | "Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=", |
| 161 | "", |
| 162 | "HTTP/1.1 200 OK", |
| 163 | "server: uvicorn", |
| 164 | "content-type: text/plain", |
| 165 | "Transfer-Encoding: chunked", |
| 166 | "", |
| 167 | "Hello, world!", |
| 168 | ] |
| 169 | |
| 170 | |
| 171 | def test_download(server): |
nothing calls this directly
no test coverage detected