本文整理汇总了Python中example_block.tests.factories.TitleFactory.title方法的典型用法代码示例。如果您正苦于以下问题:Python TitleFactory.title方法的具体用法?Python TitleFactory.title怎么用?Python TitleFactory.title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类example_block.tests.factories.TitleFactory
的用法示例。
在下文中一共展示了TitleFactory.title方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_edit_published
# 需要导入模块: from example_block.tests.factories import TitleFactory [as 别名]
# 或者: from example_block.tests.factories.TitleFactory import title [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)]