mirror of
https://github.com/ansible/awx.git
synced 2026-05-16 13:57:39 -02:30
enforce a sane default OPT_NETWORK_TIMEOUT for LDAP connections
see: #5208
This commit is contained in:
0
awx/sso/tests/functional/__init__.py
Normal file
0
awx/sso/tests/functional/__init__.py
Normal file
24
awx/sso/tests/functional/test_ldap.py
Normal file
24
awx/sso/tests/functional/test_ldap.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from django.test.utils import override_settings
|
||||
import ldap
|
||||
import pytest
|
||||
|
||||
from awx.sso.backends import LDAPSettings
|
||||
|
||||
|
||||
@override_settings(AUTH_LDAP_CONNECTION_OPTIONS = {ldap.OPT_NETWORK_TIMEOUT: 60})
|
||||
@pytest.mark.django_db
|
||||
def test_ldap_with_custom_timeout():
|
||||
settings = LDAPSettings()
|
||||
assert settings.CONNECTION_OPTIONS == {
|
||||
ldap.OPT_NETWORK_TIMEOUT: 60
|
||||
}
|
||||
|
||||
|
||||
@override_settings(AUTH_LDAP_CONNECTION_OPTIONS = {ldap.OPT_REFERRALS: 0})
|
||||
@pytest.mark.django_db
|
||||
def test_ldap_with_missing_timeout():
|
||||
settings = LDAPSettings()
|
||||
assert settings.CONNECTION_OPTIONS == {
|
||||
ldap.OPT_REFERRALS: 0,
|
||||
ldap.OPT_NETWORK_TIMEOUT: 30
|
||||
}
|
||||
Reference in New Issue
Block a user