mirror of
https://github.com/ansible/awx.git
synced 2026-03-19 01:47:31 -02:30
Merge pull request #1378 from AlanCoding/fix_unit_test
Fix conditional LDAP test fail
This commit is contained in:
@@ -2,6 +2,7 @@ import ldap
|
|||||||
|
|
||||||
from awx.sso.backends import LDAPSettings
|
from awx.sso.backends import LDAPSettings
|
||||||
from awx.sso.validators import validate_ldap_filter
|
from awx.sso.validators import validate_ldap_filter
|
||||||
|
from django.core.cache import cache
|
||||||
|
|
||||||
|
|
||||||
def test_ldap_default_settings(mocker):
|
def test_ldap_default_settings(mocker):
|
||||||
@@ -13,11 +14,11 @@ def test_ldap_default_settings(mocker):
|
|||||||
|
|
||||||
|
|
||||||
def test_ldap_default_network_timeout(mocker):
|
def test_ldap_default_network_timeout(mocker):
|
||||||
|
cache.clear() # clearing cache avoids picking up stray default for OPT_REFERRALS
|
||||||
from_db = mocker.Mock(**{'order_by.return_value': []})
|
from_db = mocker.Mock(**{'order_by.return_value': []})
|
||||||
with mocker.patch('awx.conf.models.Setting.objects.filter', return_value=from_db):
|
with mocker.patch('awx.conf.models.Setting.objects.filter', return_value=from_db):
|
||||||
settings = LDAPSettings()
|
settings = LDAPSettings()
|
||||||
assert settings.CONNECTION_OPTIONS == {
|
assert settings.CONNECTION_OPTIONS == {
|
||||||
ldap.OPT_REFERRALS: 0,
|
|
||||||
ldap.OPT_NETWORK_TIMEOUT: 30
|
ldap.OPT_NETWORK_TIMEOUT: 30
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user