MCPcopy
hub / github.com/encode/httpx / test_auth

Function test_auth

tests/test_main.py:145–168  ·  tests/test_main.py::test_auth
(server)

Source from the content-addressed store, hash-verified

143
144
145def 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
171def test_download(server):

Callers

nothing calls this directly

Calls 3

remove_date_headerFunction · 0.85
splitlinesFunction · 0.85
decodeMethod · 0.45

Tested by

no test coverage detected