Beispiel #1
0
def test_digest_www_authentication(headers):
    www_auth = WWWAuthenticate(
        'Digest', {
            'realm': '*****@*****.**',
            'qop': ['auth', 'auth-int'],
            'nonce': 'dcd98b7102dd2f0e8b11d0f600bfb0c093',
            'opaque': '5ccc069c403ebaf9f0171e9517f40e41'
        })
    www_auth = WWWAuthenticate.parse(bytes(www_auth))
    www_auth_bytes = '''WWW-Authenticate: Digest realm="*****@*****.**",
	nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093",
	opaque="5ccc069c403ebaf9f0171e9517f40e41",
	algorithm="MD5",
	qop="auth,auth-int"'''
    headers.parse(www_auth_bytes)
    assert www_auth.params == headers.elements('WWW-Authenticate')[0].params
Beispiel #2
0
def test_digest_www_authentication(headers):
	www_auth = WWWAuthenticate('Digest', {
		'realm': '*****@*****.**',
		'qop': ['auth', 'auth-int'],
		'nonce': 'dcd98b7102dd2f0e8b11d0f600bfb0c093',
		'opaque': '5ccc069c403ebaf9f0171e9517f40e41'}
	)
	www_auth = WWWAuthenticate.parse(bytes(www_auth))
	www_auth_bytes = b'''WWW-Authenticate: Digest realm="*****@*****.**",
	nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093",
	opaque="5ccc069c403ebaf9f0171e9517f40e41",
	algorithm="MD5",
	qop="auth,auth-int"'''
	headers.parse(www_auth_bytes)
	assert www_auth.params == headers.elements('WWW-Authenticate')[0].params
Beispiel #3
0
def test_digest_www_authentication(headers):
    www_auth = WWWAuthenticate(
        "Digest",
        {
            "realm": "*****@*****.**",
            "qop": ["auth", "auth-int"],
            "nonce": "dcd98b7102dd2f0e8b11d0f600bfb0c093",
            "opaque": "5ccc069c403ebaf9f0171e9517f40e41",
        },
    )
    www_auth = WWWAuthenticate.parse(bytes(www_auth))
    www_auth_bytes = '''WWW-Authenticate: Digest realm="*****@*****.**",
	nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093",
	opaque="5ccc069c403ebaf9f0171e9517f40e41",
	algorithm="MD5",
	qop="auth,auth-int"'''
    headers.parse(www_auth_bytes)
    assert www_auth.params == headers.elements("WWW-Authenticate")[0].params
Beispiel #4
0
def test_realm_replaces_quote(scheme):
	w = WWWAuthenticate(scheme)
	w.realm = u'My "Realm"'
	assert w.realm == u'My Realm'
Beispiel #5
0
def test_basic_www_authenticate(headers):
    www_auth = WWWAuthenticate('Basic', {'realm': 'simple'})
    assert bytes(www_auth) in ('Basic realm="simple"', 'Basic realm=simple')
    headers.parse('WWW-Authenticate: %s' % www_auth)
    assert headers.elements('WWW-Authenticate')[0].realm == u'simple'