Example #1
0
 def test_diazo_snippet_hide_colophon_set(self):
     """Validate the 'hide_colophon' attribute."""
     dsv = DiazoSnippetViewlet(self.portal, self.request, None)
     dsv.update()
     ploneapi.portal.set_registry_record(
         name='hide_colophon',
         value=True,
         interface=IPloneThemeSettings,
     )
     rendered = dsv.render()
     self.assertTrue(dsv.hide_colophon)
     try:
         self.assertIn('PLONE_THEMING_HIDE_COLOPHON', rendered)
     except AttributeError:
         self.assertTrue('PLONE_THEMING_HIDE_COLOPHON' in rendered)
Example #2
0
 def test_diazo_snippet_themingplugins_available(self):
     """Validate the 'themingplugins_available' attribute."""
     dsv = DiazoSnippetViewlet(self.portal, self.request, None)
     dsv.update()
     rendered = dsv.render()
     self.assertFalse(dsv.themingplugins_available)
     try:
         self.assertNotIn(
             'PLONE_THEMING_THEMINGPLUGINS_AVAILABLE',
             rendered,
         )
     except AttributeError:
         self.assertFalse(
             'PLONE_THEMING_THEMINGPLUGINS_AVAILABLE' in rendered,
         )
Example #3
0
 def test_diazo_snippet_layout_option_set(self):
     """Validate the 'layout_option' attribute."""
     dsv = DiazoSnippetViewlet(self.portal, self.request, None)
     dsv.update()
     ploneapi.portal.set_registry_record(
         name='available_layout_options',
         value=set(['boxed', 'wide']),
         interface=IPloneThemingVocabularies,
     )
     ploneapi.portal.set_registry_record(
         name='layout_option',
         value='boxed',
         interface=IPloneThemeSettings,
     )
     self.assertEqual(dsv.layout_option, 'boxed')
Example #4
0
 def test_diazo_snippet_footer_text_set(self):
     """Validate the 'footer_text' attribute."""
     dsv = DiazoSnippetViewlet(self.portal, self.request, None)
     dsv.update()
     ploneapi.portal.set_registry_record(
         name='footer_text',
         value=u'<p>&copy; Copyright 2009-{year} Your Company Name</p>',
         interface=IPloneThemeSettings,
     )
     output = dsv.footer_text
     import datetime
     year = datetime.datetime.now().strftime('%Y')
     try:
         self.assertIn('Copyright 2009-', output)
         self.assertIn(year, output)
     except AttributeError:
         self.assertTrue('Copyright 2009-' in output)
         self.assertTrue(year in output)
Example #5
0
 def test_diazo_snippet_colophon_text_set(self):
     """Validate the 'colophon_text' attribute."""
     dsv = DiazoSnippetViewlet(self.portal, self.request, None)
     dsv.update()
     ploneapi.portal.set_registry_record(
         name='colophon_text',
         value=u''.join(
             [
                 u'<p>Powered by Plone, Python & <a href="{portal_url}">'
                 u'Your Company Name</a></p>',
             ],
         ),
         interface=IPloneThemeSettings,
     )
     output = dsv.colophon_text
     url = self.portal.absolute_url()
     try:
         self.assertIn('Powered by Plone, Python', output)
         self.assertIn(url, output)
     except AttributeError:
         self.assertTrue('Powered by Plone, Python' in output)
         self.assertTrue(url in output)
Example #6
0
 def test_diazo_snippet_colophon_text(self):
     """Validate the 'colophon_text' attribute."""
     dsv = DiazoSnippetViewlet(self.portal, self.request, None)
     dsv.update()
     self.assertEqual(dsv.colophon_text, None)
Example #7
0
 def test_diazo_snippet_email(self):
     """Validate the 'email' attribute."""
     dsv = DiazoSnippetViewlet(self.portal, self.request, None)
     dsv.update()
     self.assertEqual(dsv.email, None)
Example #8
0
 def test_diazo_snippet_phone_number(self):
     """Validate the 'phone_number' attribute."""
     dsv = DiazoSnippetViewlet(self.portal, self.request, None)
     dsv.update()
     self.assertEqual(dsv.phone_number, None)
     self.assertEqual(dsv.phone_number_raw, None)
Example #9
0
 def test_diazo_snippet_slogan(self):
     """Validate the 'slogan' attribute."""
     dsv = DiazoSnippetViewlet(self.portal, self.request, None)
     dsv.update()
     self.assertEqual(dsv.slogan, None)
Example #10
0
 def test_diazo_snippet_layout_option(self):
     """Validate the 'layout_option' attribute."""
     dsv = DiazoSnippetViewlet(self.portal, self.request, None)
     dsv.update()
     self.assertEqual(dsv.layout_option, None)
Example #11
0
 def test_diazo_snippet_favicon(self):
     """Validate the 'favicon' attribute."""
     dsv = DiazoSnippetViewlet(self.portal, self.request, None)
     dsv.update()
     url = '{0}/favicon.ico'.format(self.portal.absolute_url())
     self.assertEqual(dsv.favicon, url)