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