# Path: ldaptor/config.py
# class MissingBaseDNError(Exception):
# class LDAPConfig(object):
#     def __str__(self):
#     def __init__(self,
#                  baseDN=None,
#                  serviceLocationOverrides=None,
#                  identityBaseDN=None,
#                  identitySearch=None):
#     def getBaseDN(self):
#     def getServiceLocationOverrides(self):
#     def _loadServiceLocationOverrides(self):
#     def copy(self, **kw):
#     def getIdentityBaseDN(self):
#     def getIdentitySearch(self, name):
# def loadConfig(configFiles=None,
#                reload=False):
# def useLMhash():
# DEFAULTS = {
#     'samba': { 'use-lmhash': 'no',
#                },
#     }
# CONFIG_FILES = [
#     '/etc/ldaptor/global.cfg',
#     os.path.expanduser('~/.ldaptor/global.cfg'),
#     ]


from twisted.trial import unittest
from ldaptor import config
import os
[fooSection]
fooVar = val

[barSection]
barVar = anotherVal
""")
        self.f2 = os.path.join(self.dir, 'two.cfg')
        writeFile(self.f2, """\
[fooSection]
fooVar = val2
""")
        self.cfg = config.loadConfig(
            configFiles=[self.f1, self.f2],
            reload=True)

        val = self.cfg.get('fooSection', 'fooVar')
        self.assertEquals(val, 'val2')

        val = self.cfg.get('barSection', 'barVar')
        self.assertEquals(val, 'anotherVal')

class IdentitySearch(unittest.TestCase):
    def setUp(self):
        self.dir = self.mktemp()
        os.mkdir(self.dir)
        self.f1 = os.path.join(self.dir, 'one.cfg')
        writeFile(self.f1, """\
[authentication]
identity-search = (something=%(name)s)
""")

# Path: ldaptor/config.py
# class MissingBaseDNError(Exception):
# class LDAPConfig(object):
#     def __str__(self):
#     def __init__(self,
#                  baseDN=None,
#                  serviceLocationOverrides=None,
#                  identityBaseDN=None,
#                  identitySearch=None):
#     def getBaseDN(self):
#     def getServiceLocationOverrides(self):
#     def _loadServiceLocationOverrides(self):
#     def copy(self, **kw):
#     def getIdentityBaseDN(self):
#     def getIdentitySearch(self, name):
# def loadConfig(configFiles=None,
#                reload=False):
# def useLMhash():
# DEFAULTS = {
#     'samba': { 'use-lmhash': 'no',
#                },
#     }
# CONFIG_FILES = [
#     '/etc/ldaptor/global.cfg',
#     os.path.expanduser('~/.ldaptor/global.cfg'),
#     ]


# Path: ldaptor/test/test_config.py
from twisted.trial import unittest
from ldaptor import config
import os

[fooSection]
fooVar = val

[barSection]
barVar = anotherVal
""")
        self.f2 = os.path.join(self.dir, 'two.cfg')
        writeFile(self.f2, """\
[fooSection]
fooVar = val2
""")
        self.cfg = config.loadConfig(
            configFiles=[self.f1, self.f2],
            reload=True)

        val = self.cfg.get('fooSection', 'fooVar')
        self.assertEquals(val, 'val2')

        val = self.cfg.get('barSection', 'barVar')
        self.assertEquals(val, 'anotherVal')

class IdentitySearch(unittest.TestCase):
    def setUp(self):
        self.dir = self.mktemp()
        os.mkdir(self.dir)
        self.f1 = os.path.join(self.dir, 'one.cfg')
        writeFile(self.f1, """\
[authentication]
identity-search = (something=%(name)s)
""")

        self.cfg = config.loadConfig(