本文整理匯總了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])