本文整理汇总了Python中privacyidea.lib.tokens.emailtoken.EmailTokenClass.update方法的典型用法代码示例。如果您正苦于以下问题:Python EmailTokenClass.update方法的具体用法?Python EmailTokenClass.update怎么用?Python EmailTokenClass.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类privacyidea.lib.tokens.emailtoken.EmailTokenClass
的用法示例。
在下文中一共展示了EmailTokenClass.update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_01_create_token
# 需要导入模块: from privacyidea.lib.tokens.emailtoken import EmailTokenClass [as 别名]
# 或者: from privacyidea.lib.tokens.emailtoken.EmailTokenClass import update [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.add_user(User(login="cornelius",
realm=self.realm1))
示例2: test_13_check_otp
# 需要导入模块: from privacyidea.lib.tokens.emailtoken import EmailTokenClass [as 别名]
# 或者: from privacyidea.lib.tokens.emailtoken.EmailTokenClass import update [as 别名]
def test_13_check_otp(self):
db_token = Token.query.filter_by(serial=self.serial1).first()
token = EmailTokenClass(db_token)
token.update({"otpkey": self.otpkey,
"pin": "test",
"otplen": 6,
"email": self.email})
# OTP does not exist
self.assertTrue(token.check_otp_exist("222333") == -1)
# OTP does exist
res = token.check_otp_exist("969429")
self.assertTrue(res == 3, res)
示例3: test_01_create_token
# 需要导入模块: from privacyidea.lib.tokens.emailtoken import EmailTokenClass [as 别名]
# 或者: from privacyidea.lib.tokens.emailtoken.EmailTokenClass import update [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)