MCPcopy
hub / github.com/pallets/werkzeug / test_www_authenticate_header

Method test_www_authenticate_header

tests/test_http.py:255–278  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

253 assert basic1 != object()
254
255 def test_www_authenticate_header(self):
256 wa = WWWAuthenticate.from_header('Basic realm="WallyWorld"')
257 assert wa.type == "basic"
258 assert wa.realm == "WallyWorld"
259 wa.realm = "Foo Bar"
260 assert wa.to_header() == 'Basic realm="Foo Bar"'
261
262 wa = WWWAuthenticate("bearer")
263 assert wa.to_header() == "Bearer"
264
265 wa = WWWAuthenticate.from_header(
266 'Digest realm="testrealm@host.com",'
267 ' qop="auth,auth-int",'
268 ' nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093",'
269 ' opaque="5ccc069c403ebaf9f0171e9517f40e41"'
270 )
271 assert wa.type == "digest"
272 assert wa.realm == "testrealm@host.com"
273 assert wa.parameters["qop"] == "auth,auth-int"
274 assert wa.nonce == "dcd98b7102dd2f0e8b11d0f600bfb0c093"
275 assert wa.opaque == "5ccc069c403ebaf9f0171e9517f40e41"
276
277 assert WWWAuthenticate.from_header("broken").type == "broken"
278 assert WWWAuthenticate.from_header("") is None
279
280 def test_www_authenticate_token_padding(self):
281 # padded with =

Callers

nothing calls this directly

Calls 3

to_headerMethod · 0.95
WWWAuthenticateClass · 0.90
from_headerMethod · 0.45

Tested by

no test coverage detected