#NEWLINE# def test_copy_page_copies_revisions( self ) : #NEWLINE# #INDENT# christmas_event = EventPage . objects . get ( url_path = '/home/events/christmas/' ) #NEWLINE# christmas_event . save_revision ( ) #NEWLINE# new_christmas_event = christmas_event . copy ( update_attrs = { #NEWLINE# #INDENT# 'title' : 'New christmas event' , #NEWLINE# 'slug' : 'new-christmas-event' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( new_christmas_event . revisions . count ( ) , 2 ) #NEWLINE# self . assertEqual ( christmas_event . revisions . count ( ) , 1 , 'Revisions were removed from the original page' ) #NEWLINE# latest_revision = new_christmas_event . get_latest_revision_as_page ( ) #NEWLINE# self . assertEqual ( latest_revision . title , 'New christmas event' ) #NEWLINE# self . assertEqual ( latest_revision . slug , 'new-christmas-event' ) #NEWLINE# latest_revision = new_christmas_event . get_latest_revision ( ) . as_page_object ( ) #NEWLINE# self . assertEqual ( latest_revision . title , 'New christmas event' ) #NEWLINE# self . assertEqual ( latest_revision . slug , 'new-christmas-event' ) #NEWLINE# new_revision = new_christmas_event . revisions . first ( ) #NEWLINE# new_revision_content = json . loads ( new_revision . content_json ) #NEWLINE# self . assertEqual ( new_revision_content [ 'pk' ] , new_speakers_ids . id ) #NEWLINE# self . assertEqual ( new_revision_content [ 'speakers' ] [ 0 ] [ 'page' ] , new_christmas_event . id ) #NEWLINE# old_speakers_ids = set ( christmas_event . speakers . values_list ( 'id' , flat = True ) ) #NEWLINE# new_speakers_ids = set ( ( speaker [ 'pk' ] for speaker in new_revision_content [ 'speakers' ] ) ) #NEWLINE# self . assertFalse ( old_speakers_ids . intersection ( new_speakers_ids ) , 'Child objects in revisions were not given a new primary key' )