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