LDAP credentials.
::

    >>> host = "127.0.0.1"
    >>> port = 12345
    >>> binddn = "cn=Manager,dc=my-domain,dc=com"
    >>> bindpw = "secret"

Test bda.ldap base objects.
::

    >>> from bda.ldap import BASE, ONELEVEL, SUBTREE
    >>> from bda.ldap import LDAPConnector
    >>> from bda.ldap import LDAPCommunicator

Create connector.
::

    >>> connector = LDAPConnector(host, port, binddn, bindpw, cache=False)
    >>> connector
    <bda.ldap.base.LDAPConnector object at ...>

Create communicator.
::

    >>> communicator = LDAPCommunicator(connector)
    >>> communicator
    <bda.ldap.base.LDAPCommunicator object at ...>

Bind to directory.
::

    >>> communicator.bind()

Set base dn and check if previously imported entries are present.
::

    >>> communicator.baseDN = 'dc=my-domain,dc=com'
    >>> res = communicator.search('(objectClass=*)', SUBTREE)
    >>> len(res)
    5
  
Test inserting entries.
::

    >>> entry = {
    ...     'cn':'foo',
    ...     'sn':'bar',
    ...     'objectclass':('person', 'top'),
    ... }
    >>> dn = 'cn=foo,ou=customer1,ou=customers,dc=my-domain,dc=com'
    >>> communicator.add(dn, entry)

Now there's one more entry in the directory.
::

    >>> res = communicator.search('(objectClass=*)', SUBTREE)
    >>> len(res)
    6

Query this already added entry directly.
::

    >>> res = communicator.search('(cn=foo)', SUBTREE)
    >>> res
    [('cn=foo,ou=customer1,ou=customers,dc=my-domain,dc=com', 
    {'objectClass': ['person', 'top'], 'cn': ['foo'], 'sn': ['bar']})]

Modify this entry and check the result.
::

    >>> from ldap import MOD_REPLACE
    >>> communicator.modify(res[0][0], [(MOD_REPLACE, 'sn', 'baz')])
    >>> res = communicator.search('(cn=foo)', SUBTREE)
    >>> res
    [('cn=foo,ou=customer1,ou=customers,dc=my-domain,dc=com', 
    {'objectClass': ['person', 'top'], 'cn': ['foo'], 'sn': ['baz']})]

Finally delete this entry and check the result.
::

    >>> communicator.delete(res[0][0])
    >>> communicator.search('(cn=foo)', SUBTREE)
    []

Unbind from server.
::

    >>> communicator.unbind()
