本文整理汇总了Python中zds.tutorialv2.factories.PublishableContentFactory.sha_validation方法的典型用法代码示例。如果您正苦于以下问题:Python PublishableContentFactory.sha_validation方法的具体用法?Python PublishableContentFactory.sha_validation怎么用?Python PublishableContentFactory.sha_validation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zds.tutorialv2.factories.PublishableContentFactory
的用法示例。
在下文中一共展示了PublishableContentFactory.sha_validation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_validate_tutos
# 需要导入模块: from zds.tutorialv2.factories import PublishableContentFactory [as 别名]
# 或者: from zds.tutorialv2.factories.PublishableContentFactory import sha_validation [as 别名]
def test_get_validate_tutos(self):
# Start with 0
self.assertEqual(len(self.user1.get_validate_tutos()), 0)
# Create Tuto !
validatetuto = PublishableContentFactory(type='TUTORIAL', author_list=[self.user1.user])
validatetuto.sha_validation = 'whatever'
validatetuto.save()
# Should be 1
validatetutos = self.user1.get_validate_tutos()
self.assertEqual(len(validatetutos), 1)
self.assertEqual(validatetuto, validatetutos[0])
示例2: test_get_validate_articles
# 需要导入模块: from zds.tutorialv2.factories import PublishableContentFactory [as 别名]
# 或者: from zds.tutorialv2.factories.PublishableContentFactory import sha_validation [as 别名]
def test_get_validate_articles(self):
# Start with 0
self.assertEqual(len(self.user1.get_validate_articles()), 0)
# Create article !
article = PublishableContentFactory(type='ARTICLE')
article.authors.add(self.user1.user)
article.sha_validation = 'whatever'
article.save()
# Should be 1
articles = self.user1.get_validate_articles()
self.assertEqual(len(articles), 1)
self.assertEqual(article, articles[0])