def test_answer_context_with_nested_journey_referrer(self): """If the referrer is a nested Buying a House journey page, breadcrumbs should reflect the BAH page hierarchy.""" bah_page = BrowsePage(title='Buying a House', slug='owning-a-home') helpers.publish_page(child=bah_page) journey_path = JOURNEY_PATHS[0] journey_page = BrowsePage( title='Journey page', slug=journey_path.strip('/').split('/')[-1] ) helpers.save_new_page(journey_page, bah_page) journey_child_page = BrowsePage( title='Journey child page', slug='child' ) helpers.save_new_page(journey_child_page, journey_page) page = self.page1 mock_site = mock.Mock() mock_site.root_page = HomePage.objects.get(slug='cfgov') request = HttpRequest() request.META['HTTP_REFERER'] = \ 'https://www.consumerfinance.gov' + journey_path + '/child' request.site = mock_site context = page.get_context(request) breadcrumbs = context['breadcrumb_items'] self.assertEqual(len(breadcrumbs), 3) self.assertEqual(breadcrumbs[0]['title'], 'Buying a House') self.assertEqual(breadcrumbs[1]['title'], 'Journey page') self.assertEqual(breadcrumbs[2]['title'], 'Journey child page')
def test_answer_context_with_process_segment_in_journey_referrer(self): """If the referrer is a nested Buying a House journey page, breadcrumbs should reflect the BAH page hierarchy.""" bah_page = BrowsePage(title='Buying a House', slug='owning-a-home') helpers.publish_page(child=bah_page) journey_page = BrowsePage( title='Compare page', slug='compare' ) helpers.save_new_page(journey_page, bah_page) page = self.page1 mock_site = mock.Mock() mock_site.root_page = HomePage.objects.get(slug='cfgov') request = HttpRequest() request.META['HTTP_REFERER'] = \ 'https://www.consumerfinance.gov/owning-a-home/process/compare/' request.site = mock_site context = page.get_context(request) breadcrumbs = context['breadcrumb_items'] self.assertEqual(len(breadcrumbs), 2) self.assertEqual(breadcrumbs[0]['title'], 'Buying a House') self.assertEqual(breadcrumbs[1]['title'], 'Compare page')
def test_no_duplicates(self): """ Page should show up once in results, even if field the link is in belongs to a parent page """ page = BlogPage( title='Test Blog Page', slug='test-blog-page', sidefoot=json.dumps([{ 'type': 'related_links', 'value': { 'links': [ { 'url': 'https://www.foobar.com', 'text': '' } ] }, }]) ) publish_page(page) response = self.client.post('/admin/external-links/', { 'url': 'www.foobar.com' }) self.assertContains( response, "There is 1 matching page and 0 matching snippets" )
def test_cache_gets_called_when_visiting_filterable_page(self): # Create a filterable page page = BrowseFilterablePage( title='test browse filterable page', slug='test-browse-filterable-page' ) page.content = StreamValue( page.content.stream_block, [atomic.filter_controls], True ) publish_page(page) # Add a child to that filterable page so that there are results # with a post preview child_page = BlogPage( title='test blog page', slug='test-blog-page' ) page.add_child(instance=child_page) cache = caches['post_preview'] with patch.object(cache, 'add') as add_to_cache: # Navigate to the filterable page so that `post-preview.html` loads self.client.get('/test-browse-filterable-page/') self.assertTrue(add_to_cache.called)
def test_data_snapshot_with_optional_fields(self): """ Data Snapshot with inquiry and tightness information correctly renders fields on a Browse Page""" browse_page = BrowsePage( title='Browse Page', slug='browse', ) # Adds a AUT market to a browse page browse_page.content = StreamValue( browse_page.content.stream_block, [atomic.data_snapshot_with_optional_fields], True ) publish_page(child=browse_page) response = self.client.get('/browse/') self.assertContains(response, '5 million') self.assertContains(response, '$64 billion') self.assertContains(response, '5% increase') self.assertContains(response, 'January 2015') self.assertContains(response, 'Loans originated') self.assertContains(response, 'Dollar value of new loans') self.assertContains(response, 'In year-over-year originations') # Should include inquiry or tightness information self.assertContains(response, '7.4% decrease') self.assertContains(response, 'In year-over-year inquiries') self.assertContains(response, '2.8% increase') self.assertContains(response, 'In year-over-year credit tightness')
def test_ping_google_when_job_page_published(self, flag_enabled_check): with patch('requests.get') as mock_request: helpers.publish_page(child=self.page) mock_request.assert_called_once_with( 'https://www.google.com/ping', {'sitemap': 'https://www.consumerfinance.gov/sitemap.xml'} )
def add_jobs_listing_page(slug, cls): job_category = JobCategory( job_category='CFPB Testing job category', blurb='CFPB Testing blurb' ) job_category.save() job_region = JobLocation( abbreviation='TR', name='Testing Region' ) job_region.save() jobs_listing_page = cls( close_date=datetime.now() + timedelta(days=30), description='Test Job Description', division=job_category, open_date=datetime.today(), salary_max=120000, salary_min=95000, slug=slug, title=slug, location=job_region ) publish_page(jobs_listing_page)
def add_reusable_text_snippet(slug, cls): snippet_with_heading = ReusableText( title='Test reusable text snippet with sidefoot heading', sidefoot_heading='Test sidefoot heading', text='A reusable snippet with a sidefoot heading', ) snippet_without_heading = ReusableText( title='Test reusable text snippet without a sidefoot heading', text='A reusable snippet without a sidefoot heading.', ) snippet_with_heading.save() snippet_without_heading.save() full_width_text = { 'type': 'full_width_text', 'value': [ { 'type': 'reusable_text', 'value': snippet_with_heading.id }, { 'type': 'reusable_text', 'value': snippet_without_heading.id } ] } page = cls( title=slug, slug=slug, ) page.content = StreamValue( page.content.stream_block, [full_width_text], True, ) publish_page(page)
def test_chart_block_inquiry_activity(self): """ Management command correctly updates chart block dates for inquiry index charts""" browse_page = BrowsePage( title='Browse Page', slug='browse', ) # Adds a Chart Block to a browse page browse_page.content = StreamValue( browse_page.content.stream_block, [atomic.chart_block_inquiry_activity], True ) publish_page(child=browse_page) # Call management command to update values filename = os.path.join( settings.PROJECT_ROOT, 'v1/tests/fixtures/data_snapshot.json' ) call_command( 'update_chart_block_dates', '--snapshot_file={}'.format(filename) ) response = self.client.get('/browse/') # Tests last_updated_projected_data is correct self.assertContains( response, 'The most recent data available in this visualization are for June 2018' ) # Tests date_published is correct self.assertContains(response, 'October 2018')
def setUp(self): division = JobCategory( job_category="category" ) division.save() region = Region( abbreviation="TS", name="TriStateArea" ) region.save() self.public_type = ApplicantType( applicant_type="public", description="description" ) self.public_type.save() self.status_type = ApplicantType( applicant_type="status", description="description" ) self.status_type.save() self.page = JobListingPage( title='title1', salary_min='1', salary_max='2', description='description', open_date=date(2099, 1, 1), close_date=date(2099, 1, 15), division=division, location=region, live=True) helpers.publish_page(child=self.page)
def test_single_result_per_page(self): """ Page should show up once in results, even if the same link occurs multiple times in it. """ page = BlogPage( title='Test Blog Page', slug='test-blog-page', content=json.dumps([{ 'type': 'well', 'value': { 'content': '<a href=https://www.foobar.com>...</a>' }, }]), header=json.dumps([{ 'type': 'text_introduction', 'value': { 'intro': '<a href=https://www.foobar.com>...</a>' }, }]) ) publish_page(page) response = self.client.post('/admin/external-links/', { 'url': 'www.foobar.com' }) self.assertContains( response, "There is 1 matching page and 0 matching snippets" )
def test_data_snapshot(self): """ Management command correctly updates data snapshot values""" browse_page = BrowsePage( title='Browse Page', slug='browse', ) # Adds a AUT market to a browse page browse_page.content = StreamValue( browse_page.content.stream_block, [atomic.data_snapshot], True ) publish_page(child=browse_page) # Call management command to update values filename = os.path.join( settings.PROJECT_ROOT, 'v1/tests/fixtures/data_snapshots.json' ) call_command( 'update_data_snapshot_values', '--snapshot_file={}'.format(filename) ) response = self.client.get('/browse/') self.assertContains(response, '2.1 million') self.assertContains(response, '$46.4 billion') self.assertContains(response, '5.8% increase') self.assertContains(response, 'March 2017') self.assertContains(response, 'Auto loans originated') self.assertContains(response, 'Dollar value of new loans') self.assertContains(response, 'In year-over-year originations')
def setUp(self): self.request = mock.MagicMock() self.request.site.hostname = 'localhost:8000' self.limit = 10 self.sublanding_page = SublandingPage(title='title') helpers.publish_page(child=self.sublanding_page) self.post1 = BrowseFilterablePage(title='post 1') self.post2 = BrowseFilterablePage(title='post 2') # the content of this post has both a full_width_text # and a filter_controls self.post1.content = StreamValue(self.post1.content.stream_block, [atomic.full_width_text, atomic.filter_controls], True) # this one only has a filter_controls self.post2.content = StreamValue(self.post1.content.stream_block, [atomic.filter_controls], True) helpers.save_new_page(self.post1, self.sublanding_page) helpers.save_new_page(self.post2, self.sublanding_page) # manually set the publication date of the posts to ensure consistent # order of retrieval in test situations, otherwise the `date_published` # can vary due to commit order self.child1_of_post1 = AbstractFilterPage(title='child 1 of post 1', date_published=dt.date(2016, 9, 1)) self.child2_of_post1 = AbstractFilterPage(title='child 2 of post 1', date_published=dt.date(2016, 9, 2)) self.child1_of_post2 = AbstractFilterPage(title='child 1 of post 2', date_published=dt.date(2016, 9, 3)) helpers.save_new_page(self.child1_of_post1, self.post1) helpers.save_new_page(self.child2_of_post1, self.post1) helpers.save_new_page(self.child1_of_post2, self.post2)
def test_answer_context_with_journey_referrer_and_default_category(self): """ If the referrer is a Buying a House journey page and 'mortgages' category does not appear on answer page, breadcrumbs should lead back to BAH & referrer pages, and category should default to first category on answer.""" bah_page = BrowsePage(title='Buying a House', slug='owning-a-home') helpers.publish_page(child=bah_page) journey_path = JOURNEY_PATHS[0] journey_page = BrowsePage( title='Journey page', slug=journey_path.strip('/').split('/')[-1] ) helpers.save_new_page(journey_page, bah_page) answer = self.answer1234 page = answer.english_page page.category.add(self.category) mock_site = mock.Mock() mock_site.root_page = HomePage.objects.get(slug='cfgov') request = HttpRequest() request.META['HTTP_REFERER'] = \ 'https://www.consumerfinance.gov' + journey_path request.site = mock_site context = page.get_context(request) breadcrumbs = context['breadcrumb_items'] self.assertEqual(len(breadcrumbs), 2) self.assertEqual(breadcrumbs[0]['title'], 'Buying a House') self.assertEqual(breadcrumbs[1]['title'], 'Journey page') self.assertEqual(context['category'], self.category)
def check_page_content(self, page_cls, field): page = page_cls(slug='slug', title='title') publish_page(child=page) set_stream_data(page, field, [atomic.email_signup]) publish_changes(child=page) response = self.client.get('/slug/') self.assertContains(response, 'Email Sign Up')
def page_loads_with_correct_title(self, page_cls): publish_page( page_cls( title = 'Title ABCD', slug = 'page', ) ) response = django_client.get('/page/') self.assertContains(response, 'Title ABCD')
def test_nav_does_not_include_non_browse_type_sibling_pages(self): non_browse_page = CFGOVPage(title='Non-browse page') helpers.publish_page(child=non_browse_page) nav, has_children = util.get_secondary_nav_items( self.request, self.browse_page1 ) self.assertEqual(len(nav), 2)
def test_filter_by_title(self): page1 = EventPage(title='Cool Event') page2 = EventPage(title='Awesome Event') publish_page(page1) publish_page(page2) form = self.setUpFilterableForm(data={'title': 'Cool'}) page_set = form.get_page_set() self.assertEquals(len(page_set), 1) self.assertEquals(page_set[0].specific, page1)
def test_fallback_wagtail_serve(self): publish_page(Page(title='wagtail title', slug='title')) view = TestView.as_view( flag_name=self.flag_name, fallback_view=wagtail_fail_through ) response = view(self.request(path='/title/')) self.assertContains(response, '<title>wagtail title</title>')
def test_filter_doesnt_return_drafts(self): page1 = BlogPage(title='test page 1') page1.tags.add('foo') page2 = BlogPage(title='test page 2') page2.tags.add('foo') publish_page(page1) # Only publish one of the pages form = self.setUpFilterableForm(data={'topics': ['foo']}) page_set = form.get_page_set() self.assertEquals(len(page_set), 1) self.assertEquals(page_set[0].specific, page1)
def test_has_children_is_false_for_browse_page_with_only_non_browse_children(self): browse_page3 = BrowsePage(title='Browse page 3') helpers.publish_page(child=browse_page3) child_of_browse_page3 = CFGOVPage(title='Non-browse child of browse page') helpers.save_new_page(child_of_browse_page3, browse_page3) nav, has_children = util.get_secondary_nav_items( self.request, browse_page3 ) self.assertEqual(has_children, False)
def test_live_page(self): """ Live page should load in www""" live_page = LandingPage( title='Live', slug='live', live=True, ) publish_page(child=live_page) www_response = django_client.get('/live/') self.assertEqual(www_response.status_code, 200)
def test_has_children_is_false_for_browse_page_with_no_children(self): browse_page_without_children = BrowsePage( title='Browse page without children' ) helpers.publish_page(child=browse_page_without_children) nav, has_children = util.get_secondary_nav_items( self.request, browse_page_without_children ) self.assertEqual(has_children, False)
def test_half_width_link_blob(self): """Half width link blob value correctly displays on a Landing Page""" landing_page = LandingPage( title='Landing Page', slug='landing', ) landing_page.content = StreamValue(landing_page.content.stream_block, [atomic.half_width_link_blob_group], True) publish_page(child=landing_page) response = django_client.get('/landing/') self.assertContains(response, 'this is a half width link blob')
def test_filter_by_author_names(self): page1 = BlogPage(title='test page 1') page1.authors.add('richa-agarwal') page1.authors.add('sarah-simpson') page2 = BlogPage(title='test page 2') page2.authors.add('richard-cordray') publish_page(page1) publish_page(page2) form = self.setUpFilterableForm(data={'authors': ['sarah-simpson']}) page_set = form.get_page_set() self.assertEquals(len(page_set), 1) self.assertEquals(page_set[0].specific, page1)
def test_has_children_is_true_for_browse_page_with_browse_filterable_child( self): browse_filterable_page = BrowsePage(title='Non-browse page') helpers.publish_page(child=browse_filterable_page) browse_filterable_page_child = BrowseFilterablePage( title='Child of non-browse page') helpers.save_new_page(browse_filterable_page_child, browse_filterable_page) nav, has_children = util.get_secondary_nav_items( self.request, browse_filterable_page) self.assertEqual(has_children, True)
def add_feedback_form(slug, cls): feedback_form = {'type': 'feedback', 'value': []} page = cls( title=slug, slug=slug, ) page.content = StreamValue( page.content.stream_block, [feedback_form], True, ) publish_page(page)
def test_filter_by_category(self): page1 = BlogPage(title='test page') page1.categories.add(CFGOVPageCategory(name='foo')) page1.categories.add(CFGOVPageCategory(name='bar')) page2 = BlogPage(title='another test page') page2.categories.add(CFGOVPageCategory(name='bar')) publish_page(page1) publish_page(page2) form = self.setUpFilterableForm(data={'categories': ['foo']}) page_set = form.get_page_set() self.assertEquals(len(page_set), 1) self.assertEquals(page_set[0].specific, page1)
def test_nav_includes_browse_filterable_sibling_pages(self): browse_filterable_page = BrowseFilterablePage( title='Browse filterable page') helpers.publish_page(child=browse_filterable_page) nav, has_children = util.get_secondary_nav_items( self.request, self.browse_page1) self.assertEqual(len(nav), 3) self.assertEqual(nav[0]['title'], self.browse_page1.title) self.assertEqual(nav[1]['title'], self.browse_page2.title) self.assertEqual(nav[2]['title'], browse_filterable_page.title)
def test_expandable_group(self): """Expandable group correctly displays on a Browse Page""" browse_page = BrowsePage( title='Browse Page', slug='browse', ) browse_page.content = StreamValue(browse_page.content.stream_block, [atomic.expandable_group], True) publish_page(child=browse_page) response = django_client.get('/browse/') self.assertContains(response, 'Expandable Group') self.assertContains(response, 'Expandable group body')
def test_has_children_is_false_for_browse_page_with_only_non_browse_children( self): browse_page3 = BrowsePage(title='Browse page 3') helpers.publish_page(child=browse_page3) child_of_browse_page3 = CFGOVPage( title='Non-browse child of browse page') helpers.save_new_page(child_of_browse_page3, browse_page3) nav, has_children = util.get_secondary_nav_items( self.request, browse_page3) self.assertEqual(has_children, False)
def test_item_introduction(self): """Item introduction correctly displays on a Learn Page""" learn_page = LearnPage( title='Learn Page', slug='learn', ) learn_page.header = StreamValue(learn_page.header.stream_block, [atomic.item_introduction], True) publish_page(child=learn_page) response = django_client.get('/learn/') self.assertContains(response, 'Item Introduction') self.assertContains(response, 'Item introduction body')
def test_get_latest_activities_returns_relevant_activities(self): page1 = BlogPage(title='test page') # Give it a blog subcategory page1.categories.add(CFGOVPageCategory(name='at-the-cfpb')) publish_page(page1) page2 = BlogPage(title='another test page') # Don't give it a blog subcategory publish_page(page2) activities = activity_feed.get_latest_activities(activity_type='blog') self.assertEquals(len(activities), 1) self.assertEquals(activities[0].specific, page1)
def setUp(self): super(TestActivityPage, self).setUp() self.ROOT_PAGE = HomePage.objects.get(slug='cfgov') self.ROOT_PAGE.save_revision().publish() self.index_page = ActivityIndexPage( live=True, depth=1, title='Test Index', slug='test-index', path='test-index' ) publish_page(self.index_page)
def test_notification(self): """Notification correctly displays on a Sublanding Page""" sublanding_page = SublandingPage( title='Sublanding Page', slug='sublanding', ) sublanding_page.content = StreamValue( sublanding_page.content.stream_block, [atomic.notification], True) publish_page(child=sublanding_page) response = self.client.get('/sublanding/') self.assertContains(response, 'this is a notification message') self.assertContains(response, 'this is a notification explanation') self.assertContains(response, 'this is a notification link')
def test_tableblock(self): """Table correctly displays on a Learn Page""" learn_page = LearnPage( title='Learn Page', slug='learn', ) learn_page.content = StreamValue(learn_page.content.stream_block, [atomic.table_block], True) publish_page(child=learn_page) response = django_client.get('/learn/') self.assertContains(response, 'Header One') self.assertContains(response, 'Row 1-1') self.assertContains(response, 'Row 2-1')
def test_export_script_assemble_output(self): answer = Answer(id=1234) answer.save() page = AnswerPage(slug='mock-question1-en-1234', title='Mock question1') page.answer_base = answer page.question = 'Mock question1' helpers.publish_page(page) output = assemble_output()[0] self.assertEqual(output.get('ASK_ID'), 1234) self.assertEqual(output.get('URL'), '/mock-question1-en-1234/') self.assertEqual(output.get('Question'), 'Mock question1')
def add_filterable_page(slug, cls): filterable_page = cls( title=slug, slug=slug, ) filterable_page.content = StreamValue(filterable_page.content.stream_block, [atomic.filter_controls], True) publish_page(filterable_page) add_children( parent=filterable_page, num=11, slug=slug, )
def test_text_intro(self): """Text introduction value correctly displays on a Browse Filterable Page""" bfp = BrowseFilterablePage( title='Browse Filterable Page', slug='browse-filterable-page', ) bfp.header = StreamValue( bfp.header.stream_block, [atomic.text_introduction], True ) publish_page(child=bfp) response = django_client.get('/browse-filterable-page/') self.assertContains(response, 'this is an intro')
def test_related_metadata(self): """Related metadata heading correctly displays on a Document Detail Page""" ddp = DocumentDetailPage( title='Document Detail Page', slug='ddp', ) ddp.sidefoot = StreamValue( ddp.sidefoot.stream_block, [atomic.related_metadata], True, ) publish_page(child=ddp) response = django_client.get('/ddp/') self.assertContains(response, 'this is a related metadata heading')
def test_expandable(self): """Expandable label value correctly displays on a Browse Page""" browse_page = BrowsePage( title='Browse Page', slug='browse', ) browse_page.content = StreamValue( browse_page.content.stream_block, [atomic.expandable], True, ) publish_page(child=browse_page) response = django_client.get('/browse/') self.assertContains(response, 'this is an expandable')
def test_rss_feed(self): """RSS feed correctly displays on a Sublanding Page""" sublanding_page = SublandingPage( title='Sublanding Page', slug='sublanding', ) sublanding_page.sidefoot = StreamValue( sublanding_page.sidefoot.stream_block, [atomic.rss_feed], True ) publish_page(sublanding_page) response = django_client.get('/sublanding/') self.assertContains(response, 'rss-subscribe-section')
def test_formfield_with_button(self): """FormField with Button correctly displays on a Sublanding Page""" sublanding_page = DocumentDetailPage( title='Sublanding Page', slug='sublanding', ) sublanding_page.sidefoot = StreamValue( sublanding_page.sidefoot.stream_block, [atomic.email_signup], True, ) publish_page(child=sublanding_page) response = django_client.get('/sublanding/') self.assertContains(response, 'this is a form field with button')
def test_full_width_text(self): """Full width text content correctly displays on a Learn Page""" learn_page = LearnPage( title='Learn Page', slug='learn', ) learn_page.content = StreamValue( learn_page.content.stream_block, [atomic.full_width_text], True ) publish_page(child=learn_page) response = django_client.get('/learn/') self.assertContains(response, 'Full width text content')
def test_html_block(self): """ HTML Block correctly renders HTML on a Browse Page""" browse_page = BrowsePage( title='Browse Page', slug='browse', ) browse_page.content = StreamValue( browse_page.content.stream_block, [atomic.html_block], True ) publish_page(child=browse_page) response = self.client.get('/browse/') self.assertContains(response, 'Age 30 to 44')
def setUp(self): self.request = mock.MagicMock() self.browse_page1 = BrowsePage(title='Browse page 1') self.browse_page2 = BrowsePage(title='Browse page 2') helpers.publish_page(child=self.browse_page1) helpers.publish_page(child=self.browse_page2) self.child_of_browse_page1 = BrowsePage( title='Child of browse page 1' ) self.child_of_browse_page2 = BrowsePage( title='Child of browse page 2' ) helpers.save_new_page(self.child_of_browse_page1, self.browse_page1) helpers.save_new_page(self.child_of_browse_page2, self.browse_page2)
def test_related_links(self): """Related links value correctly displays on a Landing Page""" landing_page = LandingPage( title='Landing Page', slug='landing', ) landing_page.sidefoot = StreamValue( landing_page.sidefoot.stream_block, [atomic.related_links], True ) publish_page(child=landing_page) response = django_client.get('/landing/') self.assertContains(response, 'this is a related link')
def test_call_to_action(self): """Call to action value correctly displays on a Learn Page""" learn_page = LearnPage( title='Learn', slug='learn', ) learn_page.content = StreamValue( learn_page.content.stream_block, [atomic.call_to_action], True ) publish_page(child=learn_page) response = django_client.get('/learn/') self.assertContains(response, 'this is a call to action')
def test_info_unit_group(self): """Info Unit Group correctly displays on a Landing Page""" landing_page = LandingPage( title='Landing Page', slug='landing', ) landing_page.content = StreamValue( landing_page.content.stream_block, [atomic.info_unit_group], True ) publish_page(child=landing_page) response = django_client.get('/landing/') self.assertContains(response, 'Info Unit Group')
def test_reg_comment(self): """RegComment correctly displays on a Sublanding Page""" sublanding_page = SublandingPage( title='Sublanding Page', slug='sublanding', ) sublanding_page.content = StreamValue( sublanding_page.content.stream_block, [atomic.reg_comment], True ) publish_page(child=sublanding_page) response = django_client.get('/sublanding/') self.assertContains(response, 'Enter your comments')
def test_featured_content(self): """Featured content value correctly displays on a Browse Page""" bp = BrowsePage( title='Browse Page', slug='browse-page', ) bp.header = StreamValue(bp.header.stream_block, [atomic.featured_content], True) bp.content = StreamValue(bp.content.stream_block, [atomic.expandable, atomic.expandable_group], True) publish_page(child=bp) response = django_client.get('/browse-page/') self.assertContains(response, 'this is a featured content body')
def test_well(self): """Well content correctly displays on a Landing Page""" landing_page = LandingPage( title='Landing Page', slug='landing', ) landing_page.content = StreamValue( landing_page.content.stream_block, [atomic.well], True ) publish_page(child=landing_page) response = django_client.get('/landing/') self.assertContains(response, 'this is well content')
def test_hero(self): """Hero heading correctly displays on a Sublanding Filterable Page""" sfp = SublandingFilterablePage( title='Sublanding Filterable Page', slug='sfp', ) sfp.header = StreamValue( sfp.header.stream_block, [atomic.hero], True ) publish_page(child=sfp) response = django_client.get('/sfp/') self.assertContains(response, 'this is a hero heading')