Change version of python-ldap to work with new setuptools
setuptools 40.7.0 does not work with python-ldap 2.5.2 Added unit tests to verify the code calling the python-ldap functions. Closes-Bug: 1813668 Change-Id: I1e5c0bb7ec603d4d2e03032282e268cb2189775d Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
This commit is contained in:
parent
4f816f536b
commit
3cc2f5e1fb
|
@ -20,6 +20,7 @@ import hashlib
|
|||
import os
|
||||
import os.path
|
||||
import tempfile
|
||||
import wsme
|
||||
|
||||
import mox
|
||||
import netaddr
|
||||
|
@ -28,6 +29,7 @@ from oslo_config import cfg
|
|||
from six import StringIO
|
||||
from six.moves import builtins
|
||||
from sysinv.common import exception
|
||||
from sysinv.common import service_parameter
|
||||
from sysinv.common import utils
|
||||
from sysinv.tests import base
|
||||
|
||||
|
@ -367,3 +369,44 @@ class IntLikeTestCase(base.TestCase):
|
|||
self.assertFalse(
|
||||
utils.is_int_like("0cc3346e-9fef-4445-abe6-5d2b2690ec64"))
|
||||
self.assertFalse(utils.is_int_like("a1"))
|
||||
|
||||
|
||||
class LDAPTestCase(base.TestCase):
|
||||
|
||||
def test_ldapurl(self):
|
||||
# Bad Network address is not acceptable as ldap url
|
||||
ldap_url = 'ldap://127'
|
||||
self.assertRaises(wsme.exc.ClientSideError,
|
||||
service_parameter._validate_ldap_url,
|
||||
'foo',
|
||||
ldap_url)
|
||||
|
||||
# loopback is not acceptable as ldap url
|
||||
ldap_url = 'ldap://127.0.0.1'
|
||||
self.assertRaises(wsme.exc.ClientSideError,
|
||||
service_parameter._validate_ldap_url,
|
||||
'foo',
|
||||
ldap_url)
|
||||
|
||||
# localhost is not acceptable as ldap url
|
||||
ldap_url = 'ldap://localhost:1234'
|
||||
self.assertRaises(wsme.exc.ClientSideError,
|
||||
service_parameter._validate_ldap_url,
|
||||
'foo',
|
||||
ldap_url)
|
||||
|
||||
# A valid ldap URL should not raise an exception
|
||||
ldap_url = 'ldap://dns.example.com:389'
|
||||
service_parameter._validate_ldap_url('foo', ldap_url)
|
||||
|
||||
def test_ldap_dn(self):
|
||||
# A poorly formatted ldap DN will raise a ClientSideError
|
||||
ldap_dn = 'this is not a valid ldap dn'
|
||||
self.assertRaises(wsme.exc.ClientSideError,
|
||||
service_parameter._validate_ldap_dn,
|
||||
'foo',
|
||||
ldap_dn)
|
||||
|
||||
# A valid DN will not raise a ClientSideError
|
||||
ldap_dn = 'uid=john.doe,ou=People,dc=example,dc=com'
|
||||
service_parameter._validate_ldap_dn('foo', ldap_dn)
|
||||
|
|
|
@ -28,7 +28,7 @@ libvirt-python>=1.2.5
|
|||
migrate
|
||||
python-novaclient!=2.33.0,>=2.29.0 # Apache-2.0
|
||||
python-cephclient
|
||||
python-ldap>=2.4.22,<3.0.0
|
||||
python-ldap>=3.1.0
|
||||
markupsafe
|
||||
docker
|
||||
# Babel>=0.9.6
|
||||
|
|
Loading…
Reference in New Issue