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


Python EmailTokenClass.set_user方法代码示例

本文整理汇总了Python中privacyidea.lib.tokens.emailtoken.EmailTokenClass.set_user方法的典型用法代码示例。如果您正苦于以下问题:Python EmailTokenClass.set_user方法的具体用法?Python EmailTokenClass.set_user怎么用?Python EmailTokenClass.set_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在privacyidea.lib.tokens.emailtoken.EmailTokenClass的用法示例。


在下文中一共展示了EmailTokenClass.set_user方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_01_create_token

# 需要导入模块: from privacyidea.lib.tokens.emailtoken import EmailTokenClass [as 别名]
# 或者: from privacyidea.lib.tokens.emailtoken.EmailTokenClass import set_user [as 别名]
    def test_01_create_token(self):
        db_token = Token(self.serial1, tokentype="email")
        db_token.save()
        token = EmailTokenClass(db_token)
        token.update({"email": self.email})
        token.save()
        self.assertTrue(token.token.serial == self.serial1, token)
        self.assertTrue(token.token.tokentype == "email", token.token)
        self.assertTrue(token.type == "email", token.type)
        class_prefix = token.get_class_prefix()
        self.assertTrue(class_prefix == "PIEM", class_prefix)
        self.assertTrue(token.get_class_type() == "email", token)

        # create token with dynamic email
        db_token = Token(self.serial2, tokentype="email")
        db_token.save()
        token = EmailTokenClass(db_token)
        token.update({"dynamic_email": True})
        token.save()
        self.assertTrue(is_true(token.get_tokeninfo("dynamic_email")))
        self.assertTrue(token.token.serial == self.serial2, token)
        self.assertTrue(token.token.tokentype == "email", token.token)
        self.assertTrue(token.type == "email", token.type)
        class_prefix = token.get_class_prefix()
        self.assertTrue(class_prefix == "PIEM", class_prefix)
        self.assertTrue(token.get_class_type() == "email", token)
        token.set_user(User(login="cornelius",
                            realm=self.realm1))
开发者ID:hrz-unimr,项目名称:privacyidea,代码行数:30,代码来源:test_lib_tokens_email.py

示例2: test_02_set_user

# 需要导入模块: from privacyidea.lib.tokens.emailtoken import EmailTokenClass [as 别名]
# 或者: from privacyidea.lib.tokens.emailtoken.EmailTokenClass import set_user [as 别名]
    def test_02_set_user(self):
        db_token = Token.query.filter_by(serial=self.serial1).first()
        token = EmailTokenClass(db_token)
        self.assertTrue(token.token.tokentype == "email",
                        token.token.tokentype)
        self.assertTrue(token.type == "email", token.type)

        token.set_user(User(login="cornelius",
                            realm=self.realm1))
        self.assertTrue(token.token.resolver_type == "passwdresolver",
                        token.token.resolver_type)
        self.assertTrue(token.token.resolver == self.resolvername1,
                        token.token.resolver)
        self.assertTrue(token.token.user_id == "1000",
                        token.token.user_id)

        user_object = token.get_user()
        self.assertTrue(user_object.login == "cornelius",
                        user_object)
        self.assertTrue(user_object.resolver == self.resolvername1,
                        user_object)

        token.set_user_identifiers(2000, self.resolvername1, "passwdresolver")
        self.assertTrue(int(token.token.user_id) == 2000, token.token.user_id)
开发者ID:Reality9,项目名称:privacyidea,代码行数:26,代码来源:test_lib_tokens_email.py


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