本文整理匯總了Python中example_block.tests.factories.TitleFactory.save方法的典型用法代碼示例。如果您正苦於以下問題:Python TitleFactory.save方法的具體用法?Python TitleFactory.save怎麽用?Python TitleFactory.save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類example_block.tests.factories.TitleFactory
的用法示例。
在下文中一共展示了TitleFactory.save方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_edit_published
# 需要導入模塊: from example_block.tests.factories import TitleFactory [as 別名]
# 或者: from example_block.tests.factories.TitleFactory import save [as 別名]
def test_edit_published():
"""edit published content."""
page_section = PageSectionFactory()
# block_1
block_1 = TitleBlockFactory(page_section=page_section)
TitleFactory(block=block_1, title='content_1')
block_1.publish(UserFactory())
# block_2
block_2 = TitleBlockFactory(page_section=page_section)
content_2 = TitleFactory(block=block_2, title='content_2')
block_2.publish(UserFactory())
# check pending
assert [
'content_1', 'content_2'
] == [c.title for c in Title.objects.pending(page_section)]
# check published
assert [
'content_1', 'content_2'
] == [c.title for c in Title.objects.published(page_section)]
# edit content
content_2.title = 'content_2_edit'
content_2.save()
# check pending
assert [
'content_1', 'content_2_edit'
] == [c.title for c in Title.objects.pending(page_section)]
# check published
assert [
'content_1', 'content_2'
] == [c.title for c in Title.objects.published(page_section)]