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 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_quote(self): """Quote value correctly displays on a Learn Page""" learn_page = LearnPage(title='Learn', 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, 'this is a quote') self.assertContains(response, 'a citation')
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')
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_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_email_signup(self): """Email signup correctly displays on a Sublanding Page""" sublanding_page = SublandingPage( 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, 'Email Sign up')
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_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_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_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_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_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_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_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_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_live_draft_page(self): """ Live draft page should not display unpublished content""" live_draft = LandingPage(title='Page Before Updates', slug='page', live=True) publish_page(child=live_draft) live_draft.live = False live_draft.title = 'Draft Page Updates' save_page(page=live_draft) www_response = django_client.get('/page/') self.assertContains(www_response, 'Page Before Updates') self.assertNotContains(www_response, 'Draft Page Updates')
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_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_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_image_texts(self): """Image Text molecules correctly display on a Landing Page""" landing_page = LandingPage( title='Landing Page', slug='landing', ) landing_page.content = StreamValue( landing_page.content.stream_block, [atomic.image_text_50_50_group, atomic.image_text_25_75_group], True, ) publish_page(child=landing_page) response = django_client.get('/landing/') self.assertContains(response, 'this is an image text in a 50 50 group') self.assertContains(response, 'this is an image text in a 25 75 group')
def test_main_contact_info(self): """Main contact info correctly displays on a Sublanding Page""" sublanding_page = SublandingPage( title='Sublanding Page', slug='sublanding', ) contact = self.get_contact() sublanding_page.content = StreamValue( sublanding_page.content.stream_block, [atomic.main_contact_info(contact.id)], True) publish_page(child=sublanding_page) response = django_client.get('/sublanding/') self.assertContains(response, '*****@*****.**') self.assertContains(response, '(515) 123-4567') self.assertContains(response, '123 abc street')
def test_live_draft_page(self): """ Live draft page should not display unpublished content""" live_draft = LandingPage( title='Page Before Updates', slug='page', live=True ) publish_page(child=live_draft) live_draft.live = False live_draft.title = 'Draft Page Updates' save_page(page=live_draft) www_response = django_client.get('/page/') self.assertContains(www_response, 'Page Before Updates') self.assertNotContains(www_response, 'Draft Page Updates')
def test_sidebar_contact_info(self): """Sidebar contact info correctly displays on a Landing Page""" landing_page = LandingPage( title='Landing Page', slug='landing', ) contact = self.get_contact() landing_page.sidefoot = StreamValue( landing_page.sidefoot.stream_block, [atomic.sidebar_contact(contact.id)], True) publish_page(child=landing_page) response = django_client.get('/landing/') self.assertContains(response, '*****@*****.**') self.assertContains(response, '(515) 123-4567') self.assertContains(response, '123 abc street')