Beispiel #1
0
def test_digest_auth_method(dvc):
    from requests.auth import HTTPDigestAuth

    user = "******"
    password = "******"
    auth = HTTPDigestAuth(user, password)
    config = {
        "url": "http://example.com/",
        "path_info": "file.html",
        "auth": "digest",
        "user": user,
        "password": password,
    }

    tree = HTTPTree(dvc, config)

    assert tree._auth_method() == auth
    assert isinstance(tree._auth_method(), HTTPDigestAuth)
Beispiel #2
0
def test_public_auth_method(dvc):
    config = {
        "url": "http://example.com/",
        "path_info": "file.html",
        "user": "",
        "password": "",
    }

    tree = HTTPTree(dvc, config)

    assert tree._auth_method() is None
Beispiel #3
0
def test_custom_auth_method(dvc):
    header = "Custom-Header"
    password = "******"
    config = {
        "url": "http://example.com/",
        "path_info": "file.html",
        "auth": "custom",
        "custom_auth_header": header,
        "password": password,
    }

    tree = HTTPTree(dvc, config)

    assert tree._auth_method() is None
    assert header in tree.headers
    assert tree.headers[header] == password