aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_authentication.py
blob: 25714263a4a4b638b34c134bacf926fb9b932278 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from libmproxy import authentication
from netlib import odict


class TestNullProxyAuth:
    def test_simple(self):
        na = authentication.NullProxyAuth(authentication.PermissivePasswordManager())
        assert not na.auth_challenge_headers()
        assert na.authenticate("foo")


class TestBasicProxyAuth:
    def test_simple(self):
        ba = authentication.BasicProxyAuth(authentication.PermissivePasswordManager())
        h = odict.ODictCaseless()
        assert ba.auth_challenge_headers()
        assert not ba.authenticate(h)