示例#1
0
def test_parse_http_basic_auth():
    assert proxyauth.parse_http_basic_auth(proxyauth.mkauth(
        "test", "test")) == ("basic", "test", "test")
    assert not proxyauth.parse_http_basic_auth("")
    assert not proxyauth.parse_http_basic_auth("foo bar")
    v = "basic " + binascii.b2a_base64(b"foo").decode("ascii")
    assert not proxyauth.parse_http_basic_auth(v)
示例#2
0
def test_parse_http_basic_auth():
    assert proxyauth.parse_http_basic_auth(
        proxyauth.mkauth("test", "test")
    ) == ("basic", "test", "test")
    assert not proxyauth.parse_http_basic_auth("")
    assert not proxyauth.parse_http_basic_auth("foo bar")
    v = "basic " + binascii.b2a_base64(b"foo").decode("ascii")
    assert not proxyauth.parse_http_basic_auth(v)
示例#3
0
def test_parse_http_basic_auth():
    assert proxyauth.parse_http_basic_auth(proxyauth.mkauth(
        "test", "test")) == ("basic", "test", "test")
    with pytest.raises(ValueError):
        proxyauth.parse_http_basic_auth("")
    with pytest.raises(ValueError):
        proxyauth.parse_http_basic_auth("foo bar")
    with pytest.raises(ValueError):
        proxyauth.parse_http_basic_auth("basic abc")
    with pytest.raises(ValueError):
        v = "basic " + binascii.b2a_base64(b"foo").decode("ascii")
        proxyauth.parse_http_basic_auth(v)
示例#4
0
def test_parse_http_basic_auth():
    assert proxyauth.parse_http_basic_auth(
        proxyauth.mkauth("test", "test")
    ) == ("basic", "test", "test")
    with pytest.raises(ValueError):
        proxyauth.parse_http_basic_auth("")
    with pytest.raises(ValueError):
        proxyauth.parse_http_basic_auth("foo bar")
    with pytest.raises(ValueError):
        proxyauth.parse_http_basic_auth("basic abc")
    with pytest.raises(ValueError):
        v = "basic " + binascii.b2a_base64(b"foo").decode("ascii")
        proxyauth.parse_http_basic_auth(v)
示例#5
0
 def test_parse_http_basic_auth(self):
     input = proxyauth.mkauth("test", "test")
     assert proxyauth.parse_http_basic_auth(input) == ("basic", "test", "test")
示例#6
0
 def test_parse_http_basic_auth_error(self, input):
     with pytest.raises(ValueError):
         proxyauth.parse_http_basic_auth(input)
示例#7
0
 def test_parse_http_basic_auth(self):
     input = proxyauth.mkauth("test", "test")
     assert proxyauth.parse_http_basic_auth(input) == ("basic", "test", "test")
示例#8
0
 def test_parse_http_basic_auth_error(self, input):
     with pytest.raises(ValueError):
         proxyauth.parse_http_basic_auth(input)