本文整理汇总了Python中models.Author.generate_credentials方法的典型用法代码示例。如果您正苦于以下问题:Python Author.generate_credentials方法的具体用法?Python Author.generate_credentials怎么用?Python Author.generate_credentials使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Author
的用法示例。
在下文中一共展示了Author.generate_credentials方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_can_generate_credentials
# 需要导入模块: from models import Author [as 别名]
# 或者: from models.Author import generate_credentials [as 别名]
def test_can_generate_credentials(self):
credentials = Author.generate_credentials()
self.assertTrue("username" in credentials)
self.assertTrue("password" in credentials)
self.assertEqual(len(credentials.get("username", "")), 10)
self.assertEqual(len(credentials.get("password", "")), 10)
示例2: test_generated_credentials_are_different_each_invocation
# 需要导入模块: from models import Author [as 别名]
# 或者: from models.Author import generate_credentials [as 别名]
def test_generated_credentials_are_different_each_invocation(self):
first_run = Author.generate_credentials()
second_run = Author.generate_credentials()
self.assertNotEqual(first_run.get("username", None), second_run.get("username", None))
self.assertNotEqual(first_run.get("password", None), second_run.get("password", None))