当前位置: 首页>>代码示例>>Python>>正文


Python IdResolver.testconnection方法代码示例

本文整理汇总了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)
开发者ID:woddx,项目名称:privacyidea,代码行数:27,代码来源:test_lib_resolver.py

示例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)
开发者ID:XCage15,项目名称:privacyidea,代码行数:23,代码来源:test_lib_resolver.py

示例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)
开发者ID:XCage15,项目名称:privacyidea,代码行数:23,代码来源:test_lib_resolver.py

示例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)
开发者ID:XCage15,项目名称:privacyidea,代码行数:24,代码来源:test_lib_resolver.py

示例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)
开发者ID:woddx,项目名称:privacyidea,代码行数:25,代码来源:test_lib_resolver.py

示例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)
开发者ID:woddx,项目名称:privacyidea,代码行数:26,代码来源:test_lib_resolver.py


注:本文中的privacyidea.lib.resolvers.LDAPIdResolver.IdResolver.testconnection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。