def test_migrate_page_types_and_fields(self, mock_migrate_stream_field): """ Test that the migrate_page_types_and_fields function correctly calls the migrate_stream_field function with the appropriate values from the list of page types and fields. """ mapper = mock.Mock() page_types_and_fields = [ ('tests', 'StreamPage', 'body', 'text'), ] migrate_page_types_and_fields(apps, page_types_and_fields, mapper) # Check that migrate_stream_field was correct called with the page mock_migrate_stream_field.assert_any_call(self.page, 'body', 'text', mapper) # Check that the revision lookup happened correctly and that the # revision stream field was correctly migrated. mock_migrate_stream_field.assert_any_call(self.revision, 'body', 'text', mapper)
def forward(apps, schema_editor): page_types_and_fields = [ ('v1', 'BrowseFilterablePage', 'content', 'filter_controls'), ('v1', 'SublandingFilterablePage', 'content', 'filter_controls'), ] migrate_page_types_and_fields(apps, page_types_and_fields, migrate_individual_pages)
def backwards(apps, schema_editor): page_types_and_fields = [ ('v1', 'AbstractFilterPage', 'header', 'item_introduction'), ('v1', 'DemoPage', 'header', 'item_introduction'), ] migrate_page_types_and_fields(apps, page_types_and_fields, migrate_category_field_backwards)
def migrate_forwards(apps, schema_editor): migrate_page_types_and_fields( apps, [('paying_for_college', page_type, field, 'featured_content') for page_type, field in ( ('CollegeCostsPage', 'header'), ('RepayingStudentDebtPage', 'header'), ('StudentLoanQuizPage', 'header'), )], mapper)
def forwards(apps, schema_editor): page_types_and_fields = [ ('v1', 'DocumentDetailPage', 'header', 'item_introduction'), ('v1', 'LearnPage', 'header', 'item_introduction'), ('v1', 'EventPage', 'header', 'item_introduction'), ('v1', 'DemoPage', 'header', 'item_introduction'), ] migrate_page_types_and_fields(apps, page_types_and_fields, migrate_category_field_forwards)
def forwards(apps, schema_editor): page_types_and_fields = [ ('v1', 'ActivityLogPage', 'content', 'filter_controls'), ('v1', 'NewsroomLandingPage', 'content', 'filter_controls'), ] migrate_page_types_and_fields( apps, page_types_and_fields, forward_mapper )
def forwards(apps, schema_editor): page_types_and_fields = [ ('v1', 'BlogPage', 'content', 'full_width_text'), ('v1', 'BrowseFilterablePage', 'content', 'full_width_text'), ('v1', 'BrowsePage', 'content', 'full_width_text'), ('v1', 'LearnPage', 'content', 'full_width_text'), ('v1', 'DocumentDetailPage', 'content', 'full_width_text'), ('v1', 'SublandingFilterablePage', 'content', 'full_width_text'), ('v1', 'SublandingPage', 'content', 'full_width_text'), ] migrate_page_types_and_fields(apps, page_types_and_fields, forward_mapper)
def migrate_forwards(apps, schema_editor): migrate_page_types_and_fields( apps, [ ('v1', page_type, field, 'featured_content') for page_type, field in ( ('BrowseFilterablePage', 'header'), ('BrowsePage', 'header'), ('SublandingFilterablePage', 'content'), ('SublandingPage', 'content'), ) ], mapper )
def backwards(apps, schema_editor): page_types_and_fields = [ ('regulations3k', 'RegulationPage', 'content', 'full_width_text'), ('v1', 'BlogPage', 'content', 'full_width_text'), ('v1', 'BrowseFilterablePage', 'content', 'full_width_text'), ('v1', 'BrowsePage', 'content', 'full_width_text'), ('v1', 'LearnPage', 'content', 'full_width_text'), ('v1', 'DocumentDetailPage', 'content', 'full_width_text'), ('v1', 'SublandingFilterablePage', 'content', 'full_width_text'), ('v1', 'SublandingPage', 'content', 'full_width_text'), ] migrate_page_types_and_fields(apps, page_types_and_fields, backward_mapper)
def migrate_forwards(apps, schema_editor): migrate_page_types_and_fields( apps, [ ('ask_cfpb', 'AnswerPage', 'answer_content', 'video_player'), ('ask_cfpb', 'AnswerPage', 'answer_content', ( 'faq_schema', 'questions', 'answer_content', 'video_player', )), ('ask_cfpb', 'AnswerPage', 'answer_content', ( 'how_to_schema', 'steps', 'step_content', 'video_player', )), ], mapper )
def forwards(apps, schema_editor): page_types_and_fields = [ ('ask_cfpb', 'AnswerPage', 'sidebar', 'email_signup'), ('regulations3k', 'RegulationPage', 'content', ['full_width_text', 'email_signup']), ('regulations3k', 'RegulationLandingPage', 'content', ['full_width_text', 'email_signup']), ('v1', 'CFGOVPage', 'sidefoot', 'email_signup'), ('v1', 'BlogPage', 'content', 'email_signup'), ('v1', 'BlogPage', 'content', ['full_width_text', 'email_signup']), ('v1', 'BrowsePage', 'content', ['full_width_text', 'email_signup']), ('v1', 'BrowseFilterablePage', 'content', ['full_width_text', 'email_signup']), ('v1', 'DocumentDetailPage', 'content', ['full_width_text', 'email_signup']), ('v1', 'LearnPage', 'content', 'email_signup'), ('v1', 'LearnPage', 'content', ['full_width_text', 'email_signup']), ('v1', 'SublandingPage', 'content', ['full_width_text', 'email_signup']), ('v1', 'SublandingFilterablePage', 'content', ['full_width_text', 'email_signup']), ] migrate_page_types_and_fields(apps, page_types_and_fields, forward_mapper)