From 35f299679ff9740f8c26661dde8458d4e67efcca Mon Sep 17 00:00:00 2001 From: "Mike A." Date: Wed, 11 Sep 2024 00:00:13 +0200 Subject: [PATCH] Rewrite guess auth test for unsupported status --- tests/storage/test_http.py | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/tests/storage/test_http.py b/tests/storage/test_http.py index 22c9ee9..091dfd9 100644 --- a/tests/storage/test_http.py +++ b/tests/storage/test_http.py @@ -6,7 +6,8 @@ from aioresponses import aioresponses from tests import normalize_item 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 prepare_auth @@ -106,20 +107,12 @@ def test_prepare_auth(): assert "unknown authentication method" in str(excinfo.value).lower() -def test_prepare_auth_guess(monkeypatch): - import requests_toolbelt.auth.guess - - assert isinstance( - prepare_auth("guess", "user", "pwd"), - requests_toolbelt.auth.guess.GuessAuth, - ) - - monkeypatch.delattr(requests_toolbelt.auth.guess, "GuessAuth") - +def test_prepare_auth_guess(): + # guess auth is currently not supported 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):