|
1 | 1 | from __future__ import annotations
|
2 | 2 |
|
3 | 3 | import pytest
|
4 |
| -from aiohttp import BasicAuth |
5 | 4 | from aioresponses import CallbackResult
|
6 | 5 | from aioresponses import aioresponses
|
7 | 6 |
|
8 | 7 | from tests import normalize_item
|
9 | 8 | from vdirsyncer.exceptions import UserError
|
| 9 | +from vdirsyncer.http import BasicAuthMethod, DigestAuthMethod |
10 | 10 | from vdirsyncer.storage.http import HttpStorage
|
11 | 11 | from vdirsyncer.storage.http import prepare_auth
|
12 | 12 |
|
@@ -91,16 +91,14 @@ def test_readonly_param(aio_connector):
|
91 | 91 | def test_prepare_auth():
|
92 | 92 | assert prepare_auth(None, "", "") is None
|
93 | 93 |
|
94 |
| - assert prepare_auth(None, "user", "pwd") == BasicAuth("user", "pwd") |
95 |
| - assert prepare_auth("basic", "user", "pwd") == BasicAuth("user", "pwd") |
| 94 | + assert prepare_auth(None, "user", "pwd") == BasicAuthMethod("user", "pwd") |
| 95 | + assert prepare_auth("basic", "user", "pwd") == BasicAuthMethod("user", "pwd") |
96 | 96 |
|
97 | 97 | with pytest.raises(ValueError) as excinfo:
|
98 | 98 | assert prepare_auth("basic", "", "pwd")
|
99 | 99 | assert "you need to specify username and password" in str(excinfo.value).lower()
|
100 | 100 |
|
101 |
| - from requests.auth import HTTPDigestAuth |
102 |
| - |
103 |
| - assert isinstance(prepare_auth("digest", "user", "pwd"), HTTPDigestAuth) |
| 101 | + assert isinstance(prepare_auth("digest", "user", "pwd"), DigestAuthMethod) |
104 | 102 |
|
105 | 103 | with pytest.raises(ValueError) as excinfo:
|
106 | 104 | prepare_auth("ladida", "user", "pwd")
|
|
0 commit comments