mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +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
|
may want to subscribe to `GitHub's tag feed
|
||||||
<https://github.com/pimutils/vdirsyncer/tags.atom>`_.
|
<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
|
Version 0.11.2
|
||||||
==============
|
==============
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,9 @@ def test_readonly_param():
|
||||||
def test_prepare_auth():
|
def test_prepare_auth():
|
||||||
assert prepare_auth(None, '', '') is None
|
assert prepare_auth(None, '', '') is None
|
||||||
|
|
||||||
|
assert prepare_auth(None, 'user', 'pwd') == ('user', 'pwd')
|
||||||
assert prepare_auth('basic', 'user', 'pwd') == ('user', 'pwd')
|
assert prepare_auth('basic', 'user', 'pwd') == ('user', 'pwd')
|
||||||
|
|
||||||
with pytest.raises(ValueError) as excinfo:
|
with pytest.raises(ValueError) as excinfo:
|
||||||
assert prepare_auth('basic', '', 'pwd')
|
assert prepare_auth('basic', '', 'pwd')
|
||||||
assert 'you need to specify username and password' in \
|
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()
|
assert 'unknown authentication method' in str(excinfo.value).lower()
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('auth', (None, 'guess'))
|
def test_prepare_auth_guess(monkeypatch):
|
||||||
def test_prepare_auth_guess(monkeypatch, auth):
|
|
||||||
import requests_toolbelt.auth.guess
|
import requests_toolbelt.auth.guess
|
||||||
|
|
||||||
assert isinstance(prepare_auth(auth, 'user', 'pwd'),
|
assert isinstance(prepare_auth('guess', 'user', 'pwd'),
|
||||||
requests_toolbelt.auth.guess.GuessAuth)
|
requests_toolbelt.auth.guess.GuessAuth)
|
||||||
|
|
||||||
monkeypatch.delattr(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(auth, 'user', 'pwd')
|
prepare_auth('guess', 'user', 'pwd')
|
||||||
|
|
||||||
assert 'requests_toolbelt is too old' in str(excinfo.value).lower()
|
assert 'requests_toolbelt is too old' in str(excinfo.value).lower()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,12 +12,12 @@ USERAGENT = 'vdirsyncer'
|
||||||
|
|
||||||
def prepare_auth(auth, username, password):
|
def prepare_auth(auth, username, password):
|
||||||
if username and password:
|
if username and password:
|
||||||
if auth == 'basic':
|
if auth == 'basic' or auth is None:
|
||||||
return (username, password)
|
return (username, password)
|
||||||
elif auth == 'digest':
|
elif auth == 'digest':
|
||||||
from requests.auth import HTTPDigestAuth
|
from requests.auth import HTTPDigestAuth
|
||||||
return HTTPDigestAuth(username, password)
|
return HTTPDigestAuth(username, password)
|
||||||
elif auth == 'guess' or auth is None:
|
elif auth == 'guess':
|
||||||
try:
|
try:
|
||||||
from requests_toolbelt.auth.guess import GuessAuth
|
from requests_toolbelt.auth.guess import GuessAuth
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
@ -80,9 +80,11 @@ HTTP_STORAGE_PARAMETERS = '''
|
||||||
:param verify_fingerprint: Optional. SHA1 or MD5 fingerprint of the
|
:param verify_fingerprint: Optional. SHA1 or MD5 fingerprint of the
|
||||||
expected server certificate. See :ref:`ssl-tutorial` for more
|
expected server certificate. See :ref:`ssl-tutorial` for more
|
||||||
information.
|
information.
|
||||||
:param auth: Optional. Either ``basic``, ``digest`` or ``guess``. Default
|
:param auth: Optional. Either ``basic``, ``digest`` or ``guess``. The
|
||||||
``guess``. If you know yours, consider setting it explicitly for
|
default is preemptive Basic auth, sending credentials even if server
|
||||||
performance.
|
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
|
: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.
|
certificate and the key or a list of paths to the files with them.
|
||||||
:param useragent: Default ``vdirsyncer``.
|
:param useragent: Default ``vdirsyncer``.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue