本文整理汇总了Python中ldapcherry.LdapCherry._get_user方法的典型用法代码示例。如果您正苦于以下问题:Python LdapCherry._get_user方法的具体用法?Python LdapCherry._get_user怎么用?Python LdapCherry._get_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ldapcherry.LdapCherry
的用法示例。
在下文中一共展示了LdapCherry._get_user方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testGetUser
# 需要导入模块: from ldapcherry import LdapCherry [as 别名]
# 或者: from ldapcherry.LdapCherry import _get_user [as 别名]
def testGetUser(self):
app = LdapCherry()
loadconf('./tests/cfg/ldapcherry_test.ini', app)
expected = {
'password': u'passwordsmith',
'cn': u'Sheri Smith',
'uid': u'ssmith',
'name': u'smith',
'email': [u'[email protected]',
u'[email protected]',
u'[email protected]'
],
}
ret = app._get_user('ssmith')
assert expected == ret
示例2: ValueError
# 需要导入模块: from ldapcherry import LdapCherry [as 别名]
# 或者: from ldapcherry.LdapCherry import _get_user [as 别名]
if section not in result:
result[section] = {}
for option in self.options(section):
value = self.get(section, option, raw=raw, vars=vars)
try:
value = cherrypy.lib.reprconf.unrepr(value)
except Exception:
x = sys.exc_info()[1]
msg = ("Config error in section: %r, option: %r, "
"value: %r. Config values must be valid Python." %
(section, option, value))
raise ValueError(msg, x.__class__.__name__, x.args)
result[section][option] = value
return result
cherrypy.lib.reprconf.Parser.as_dict = new_as_dict
def loadconf(configfile, instance):
app = cherrypy.tree.mount(instance, '/', configfile)
cherrypy.config.update(configfile)
instance.reload(app.config)
app = LdapCherry()
loadconf('./tests/cfg/ldapcherry.ini', app)
ret = app._get_user('ssmith')
print ret
}
form = {'groups': {}, 'attrs': {'password1': u'password☭', 'password2': u'password☭', 'shell': u'/bin/zsh', 'cn': u'Test ☭ Test', 'name': u'Test ☭', 'uidNumber': u'1000', 'gidNumber': u'1000', 'home': u'/home/test', 'first-name': u'Test ☭', 'email': u'[email protected]', 'uid': u'test'}, 'roles': {'admin-lv3': u'on', 'admin-lv2': u'on', 'users': u'on'}}