本文整理汇总了Python中privacyidea.lib.tokens.emailtoken.EmailTokenClass.save方法的典型用法代码示例。如果您正苦于以下问题:Python EmailTokenClass.save方法的具体用法?Python EmailTokenClass.save怎么用?Python EmailTokenClass.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类privacyidea.lib.tokens.emailtoken.EmailTokenClass
的用法示例。
在下文中一共展示了EmailTokenClass.save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_01_create_token
# 需要导入模块: from privacyidea.lib.tokens.emailtoken import EmailTokenClass [as 别名]
# 或者: from privacyidea.lib.tokens.emailtoken.EmailTokenClass import save [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_01_create_token
# 需要导入模块: from privacyidea.lib.tokens.emailtoken import EmailTokenClass [as 别名]
# 或者: from privacyidea.lib.tokens.emailtoken.EmailTokenClass import save [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)