mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +00:00
parent
3228e22621
commit
e4a0afcf00
3 changed files with 19 additions and 9 deletions
|
|
@ -9,6 +9,13 @@ Package maintainers and users who have to manually update their installation
|
|||
may want to subscribe to `GitHub's tag feed
|
||||
<https://github.com/pimutils/vdirsyncer/tags.atom>`_.
|
||||
|
||||
Version 0.11.3
|
||||
==============
|
||||
|
||||
- Default value of ``auth`` parameter was changed from ``guess`` to ``basic``
|
||||
to resolve issues with the Apple Calendar Server (:gh:`457`) and improve
|
||||
performance. See :gh:`461`.
|
||||
|
||||
Version 0.11.2
|
||||
==============
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,9 @@ def test_readonly_param():
|
|||
def test_prepare_auth():
|
||||
assert prepare_auth(None, '', '') is None
|
||||
|
||||
assert prepare_auth(None, 'user', 'pwd') == ('user', 'pwd')
|
||||
assert prepare_auth('basic', 'user', 'pwd') == ('user', 'pwd')
|
||||
|
||||
with pytest.raises(ValueError) as excinfo:
|
||||
assert prepare_auth('basic', '', 'pwd')
|
||||
assert 'you need to specify username and password' in \
|
||||
|
|
@ -99,17 +101,16 @@ def test_prepare_auth():
|
|||
assert 'unknown authentication method' in str(excinfo.value).lower()
|
||||
|
||||
|
||||
@pytest.mark.parametrize('auth', (None, 'guess'))
|
||||
def test_prepare_auth_guess(monkeypatch, auth):
|
||||
def test_prepare_auth_guess(monkeypatch):
|
||||
import requests_toolbelt.auth.guess
|
||||
|
||||
assert isinstance(prepare_auth(auth, 'user', 'pwd'),
|
||||
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:
|
||||
prepare_auth(auth, 'user', 'pwd')
|
||||
prepare_auth('guess', 'user', 'pwd')
|
||||
|
||||
assert 'requests_toolbelt is too old' in str(excinfo.value).lower()
|
||||
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@ USERAGENT = 'vdirsyncer'
|
|||
|
||||
def prepare_auth(auth, username, password):
|
||||
if username and password:
|
||||
if auth == 'basic':
|
||||
if auth == 'basic' or auth is None:
|
||||
return (username, password)
|
||||
elif auth == 'digest':
|
||||
from requests.auth import HTTPDigestAuth
|
||||
return HTTPDigestAuth(username, password)
|
||||
elif auth == 'guess' or auth is None:
|
||||
elif auth == 'guess':
|
||||
try:
|
||||
from requests_toolbelt.auth.guess import GuessAuth
|
||||
except ImportError:
|
||||
|
|
@ -80,9 +80,11 @@ HTTP_STORAGE_PARAMETERS = '''
|
|||
:param verify_fingerprint: Optional. SHA1 or MD5 fingerprint of the
|
||||
expected server certificate. See :ref:`ssl-tutorial` for more
|
||||
information.
|
||||
:param auth: Optional. Either ``basic``, ``digest`` or ``guess``. Default
|
||||
``guess``. If you know yours, consider setting it explicitly for
|
||||
performance.
|
||||
:param auth: Optional. Either ``basic``, ``digest`` or ``guess``. The
|
||||
default is preemptive Basic auth, sending credentials even if server
|
||||
didn't request them. This saves from an additional roundtrip per
|
||||
request. Consider setting ``guess`` if this causes issues with your
|
||||
server.
|
||||
:param auth_cert: Optional. Either a path to a certificate with a client
|
||||
certificate and the key or a list of paths to the files with them.
|
||||
:param useragent: Default ``vdirsyncer``.
|
||||
|
|
|
|||
Loading…
Reference in a new issue