本文整理汇总了Python中privacyidea.lib.resolvers.LDAPIdResolver.IdResolver.testconnection方法的典型用法代码示例。如果您正苦于以下问题:Python IdResolver.testconnection方法的具体用法?Python IdResolver.testconnection怎么用?Python IdResolver.testconnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类privacyidea.lib.resolvers.LDAPIdResolver.IdResolver
的用法示例。
在下文中一共展示了IdResolver.testconnection方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_05_authtype_not_supported
# 需要导入模块: from privacyidea.lib.resolvers.LDAPIdResolver import IdResolver [as 别名]
# 或者: from privacyidea.lib.resolvers.LDAPIdResolver.IdResolver import testconnection [as 别名]
def test_05_authtype_not_supported(self):
ldap3mock.setLDAPDirectory(LDAPDirectory)
y = LDAPResolver()
res = y.testconnection(
{
"LDAPURI": "ldap://localhost",
"LDAPBASE": "o=test",
"BINDDN": "cn=manager,ou=example,o=test",
"BINDPW": "ldaptest",
"AUTHTYPE": "unknown",
"LOGINNAMEATTRIBUTE": "cn",
"LDAPSEARCHFILTER": "(cn=*)",
"LDAPFILTER": "(&(cn=%s))",
"USERINFO": '{ "username": "cn",'
'"phone" : "telephoneNumber", '
'"mobile" : "mobile"'
', "email" : "mail", '
'"surname" : "sn", '
'"givenname" : "givenName" }',
"UIDTYPE": "oid",
}
)
self.assertFalse(res[0], res)
self.assertTrue("Authtype unknown not supported" in res[1], res)
示例2: test_04_testconnection_fail
# 需要导入模块: from privacyidea.lib.resolvers.LDAPIdResolver import IdResolver [as 别名]
# 或者: from privacyidea.lib.resolvers.LDAPIdResolver.IdResolver import testconnection [as 别名]
def test_04_testconnection_fail(self):
ldap3mock.setLDAPDirectory(LDAPDirectory)
y = LDAPResolver()
res = y.testconnection({'LDAPURI': 'ldap://localhost',
'LDAPBASE': 'o=test',
'BINDDN': 'cn=manager,ou=example,o=test',
'BINDPW': 'wrongpw',
'LOGINNAMEATTRIBUTE': 'cn',
'LDAPSEARCHFILTER': '(cn=*)',
'LDAPFILTER': '(&(cn=%s))',
'USERINFO': '{ "username": "cn",'
'"phone" : "telephoneNumber", '
'"mobile" : "mobile"'
', "email" : "mail", '
'"surname" : "sn", '
'"givenname" : "givenName" }',
'UIDTYPE': 'oid',
})
self.assertFalse(res[0], res)
self.assertTrue("Wrong credentials" in res[1], res)
示例3: test_03_testconnection_anonymous
# 需要导入模块: from privacyidea.lib.resolvers.LDAPIdResolver import IdResolver [as 别名]
# 或者: from privacyidea.lib.resolvers.LDAPIdResolver.IdResolver import testconnection [as 别名]
def test_03_testconnection_anonymous(self):
ldap3mock.setLDAPDirectory(LDAPDirectory)
y = LDAPResolver()
res = y.testconnection({'LDAPURI': 'ldap://localhost',
'LDAPBASE': 'o=test',
'LOGINNAMEATTRIBUTE': 'cn',
'LDAPSEARCHFILTER': '(cn=*)',
'BINDDN': '',
'LDAPFILTER': '(&(cn=%s))',
'USERINFO': '{ "username": "cn",'
'"phone" : "telephoneNumber", '
'"mobile" : "mobile"'
', "email" : "mail", '
'"surname" : "sn", '
'"givenname" : "givenName" }',
'UIDTYPE': 'oid',
})
self.assertTrue(res[0], res)
self.assertTrue(res[1] == 'Your LDAP config seems to be OK, 3 user '
'objects found.', res)
示例4: test_05_authtype_not_supported
# 需要导入模块: from privacyidea.lib.resolvers.LDAPIdResolver import IdResolver [as 别名]
# 或者: from privacyidea.lib.resolvers.LDAPIdResolver.IdResolver import testconnection [as 别名]
def test_05_authtype_not_supported(self):
ldap3mock.setLDAPDirectory(LDAPDirectory)
y = LDAPResolver()
res = y.testconnection({'LDAPURI': 'ldap://localhost',
'LDAPBASE': 'o=test',
'BINDDN': 'cn=manager,ou=example,o=test',
'BINDPW': 'ldaptest',
'AUTHTYPE': 'unknown',
'LOGINNAMEATTRIBUTE': 'cn',
'LDAPSEARCHFILTER': '(cn=*)',
'LDAPFILTER': '(&(cn=%s))',
'USERINFO': '{ "username": "cn",'
'"phone" : "telephoneNumber", '
'"mobile" : "mobile"'
', "email" : "mail", '
'"surname" : "sn", '
'"givenname" : "givenName" }',
'UIDTYPE': 'oid',
})
self.assertFalse(res[0], res)
self.assertTrue("Authtype unknown not supported" in res[1], res)
示例5: test_03_testconnection_anonymous
# 需要导入模块: from privacyidea.lib.resolvers.LDAPIdResolver import IdResolver [as 别名]
# 或者: from privacyidea.lib.resolvers.LDAPIdResolver.IdResolver import testconnection [as 别名]
def test_03_testconnection_anonymous(self):
ldap3mock.setLDAPDirectory(LDAPDirectory)
y = LDAPResolver()
res = y.testconnection(
{
"LDAPURI": "ldap://localhost",
"LDAPBASE": "o=test",
"LOGINNAMEATTRIBUTE": "cn",
"LDAPSEARCHFILTER": "(cn=*)",
"BINDDN": "",
"LDAPFILTER": "(&(cn=%s))",
"USERINFO": '{ "username": "cn",'
'"phone" : "telephoneNumber", '
'"mobile" : "mobile"'
', "email" : "mail", '
'"surname" : "sn", '
'"givenname" : "givenName" }',
"UIDTYPE": "oid",
}
)
self.assertTrue(res[0], res)
self.assertTrue(res[1] == "Your LDAP config seems to be OK, 3 user " "objects found.", res)
示例6: test_04_testconnection_fail
# 需要导入模块: from privacyidea.lib.resolvers.LDAPIdResolver import IdResolver [as 别名]
# 或者: from privacyidea.lib.resolvers.LDAPIdResolver.IdResolver import testconnection [as 别名]
def test_04_testconnection_fail(self):
ldap3mock.setLDAPDirectory(LDAPDirectory)
y = LDAPResolver()
res = y.testconnection(
{
"LDAPURI": "ldap://localhost",
"LDAPBASE": "o=test",
"BINDDN": "cn=manager,ou=example,o=test",
"BINDPW": "wrongpw",
"LOGINNAMEATTRIBUTE": "cn",
"LDAPSEARCHFILTER": "(cn=*)",
"LDAPFILTER": "(&(cn=%s))",
"USERINFO": '{ "username": "cn",'
'"phone" : "telephoneNumber", '
'"mobile" : "mobile"'
', "email" : "mail", '
'"surname" : "sn", '
'"givenname" : "givenName" }',
"UIDTYPE": "oid",
}
)
self.assertFalse(res[0], res)
self.assertTrue("Wrong credentials" in res[1], res)