mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Rewrite guess auth test for unsupported status
This commit is contained in:
parent
67e1c0ded5
commit
35f299679f
1 changed files with 6 additions and 13 deletions
|
|
@ -6,7 +6,8 @@ from aioresponses import aioresponses
|
||||||
|
|
||||||
from tests import normalize_item
|
from tests import normalize_item
|
||||||
from vdirsyncer.exceptions import UserError
|
from vdirsyncer.exceptions import UserError
|
||||||
from vdirsyncer.http import BasicAuthMethod, DigestAuthMethod
|
from vdirsyncer.http import BasicAuthMethod
|
||||||
|
from vdirsyncer.http import DigestAuthMethod
|
||||||
from vdirsyncer.storage.http import HttpStorage
|
from vdirsyncer.storage.http import HttpStorage
|
||||||
from vdirsyncer.storage.http import prepare_auth
|
from vdirsyncer.storage.http import prepare_auth
|
||||||
|
|
||||||
|
|
@ -106,20 +107,12 @@ def test_prepare_auth():
|
||||||
assert "unknown authentication method" in str(excinfo.value).lower()
|
assert "unknown authentication method" in str(excinfo.value).lower()
|
||||||
|
|
||||||
|
|
||||||
def test_prepare_auth_guess(monkeypatch):
|
def test_prepare_auth_guess():
|
||||||
import requests_toolbelt.auth.guess
|
# guess auth is currently not supported
|
||||||
|
|
||||||
assert isinstance(
|
|
||||||
prepare_auth("guess", "user", "pwd"),
|
|
||||||
requests_toolbelt.auth.guess.GuessAuth,
|
|
||||||
)
|
|
||||||
|
|
||||||
monkeypatch.delattr(requests_toolbelt.auth.guess, "GuessAuth")
|
|
||||||
|
|
||||||
with pytest.raises(UserError) as excinfo:
|
with pytest.raises(UserError) as excinfo:
|
||||||
prepare_auth("guess", "user", "pwd")
|
prepare_auth("guess", "usr", "pwd")
|
||||||
|
|
||||||
assert "requests_toolbelt is too old" in str(excinfo.value).lower()
|
assert "not supported" in str(excinfo.value).lower()
|
||||||
|
|
||||||
|
|
||||||
def test_verify_false_disallowed(aio_connector):
|
def test_verify_false_disallowed(aio_connector):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue