Exemple #1
0
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)]