Beispiel #1
0
def test_get_auth_scheme_bad_request():
    with patch('requests.Response') as mock:
        mock.headers = {'www-authenticate': ''}
        res = http.get_auth_scheme(mock)
        assert res is None
Beispiel #2
0
def test_get_auth_scheme_acs():
    with patch('requests.Response') as mock:
        mock.headers = {'www-authenticate': 'acsjwt'}
        auth_scheme, realm = http.get_auth_scheme(mock)
        assert auth_scheme == "acsjwt"
        assert realm == "acsjwt"
Beispiel #3
0
def test_get_auth_scheme_basic():
    with patch('requests.Response') as mock:
        mock.headers = {'www-authenticate': 'Basic realm="Restricted"'}
        auth_scheme, realm = http.get_auth_scheme(mock)
        assert auth_scheme == "basic"
        assert realm == "restricted"
Beispiel #4
0
def test_get_auth_scheme_bad_request():
    with patch('requests.Response') as mock:
        mock.headers = {'www-authenticate': ''}
        res = http.get_auth_scheme(mock)
        assert res == (None, None)
Beispiel #5
0
def test_get_auth_scheme_oauth():
    with patch('requests.Response') as mock:
        mock.headers = {'www-authenticate': 'oauthjwt'}
        auth_scheme, realm = http.get_auth_scheme(mock)
        assert auth_scheme == "oauthjwt"
        assert realm == "oauthjwt"
Beispiel #6
0
def test_get_auth_scheme_basic():
    with patch('requests.Response') as mock:
        mock.headers = {'www-authenticate': 'Basic realm="Restricted"'}
        auth_scheme, realm = http.get_auth_scheme(mock)
        assert auth_scheme == "basic"
        assert realm == "restricted"