Esempio n. 1
0
 def test_diazo_snippets_viewlet_render(self):
     """Validate that the diazo snippet viewlet renders correctly."""
     dsv = DiazoSnippetViewlet(self.portal, self.request, None)
     dsv.update()
     rendered = dsv.render()
     try:
         self.assertIn('spirit_plone_theming_diazo_snippets', rendered)
     except AttributeError:
         self.assertTrue('spirit_plone_theming_diazo_snippets' in rendered)
Esempio n. 2
0
 def test_diazo_snippets_debug_style(self):
     """Validate that the diazo snippet viewlet applies correct CSS."""
     dsv = DiazoSnippetViewlet(self.portal, self.request, None)
     dsv.update()
     rendered = dsv.render()
     self.assertEqual(dsv.debug_style, 'none')
     try:
         self.assertIn('style="display: none"', rendered)
     except AttributeError:
         self.assertTrue('style="display: none"' in rendered)
Esempio n. 3
0
 def test_diazo_snippet_hide_searchbox(self):
     """Validate the 'hide_searchbox' attribute."""
     dsv = DiazoSnippetViewlet(self.portal, self.request, None)
     dsv.update()
     rendered = dsv.render()
     self.assertFalse(dsv.hide_searchbox)
     try:
         self.assertNotIn('PLONE_THEMING_HIDE_SEARCHBOX', rendered)
     except AttributeError:
         self.assertFalse('PLONE_THEMING_HIDE_SEARCHBOX' in rendered)
Esempio n. 4
0
 def test_diazo_snippet_email_set(self):
     """Validate the 'email' attribute."""
     dsv = DiazoSnippetViewlet(self.portal, self.request, None)
     dsv.update()
     ploneapi.portal.set_registry_record(
         name='email',
         value=u'*****@*****.**',
         interface=IPloneThemeSettings,
     )
     self.assertEqual(dsv.email, u'*****@*****.**')
Esempio n. 5
0
 def test_diazo_snippet_slogan_set(self):
     """Validate the 'slogan' attribute."""
     dsv = DiazoSnippetViewlet(self.portal, self.request, None)
     dsv.update()
     ploneapi.portal.set_registry_record(
         name='slogan',
         value=u'This is my slogan.',
         interface=IPloneThemeSettings,
     )
     self.assertEqual(dsv.slogan, u'This is my slogan.')
Esempio n. 6
0
 def test_diazo_snippet_rapido_available(self):
     """Validate the 'rapido_available' attribute."""
     dsv = DiazoSnippetViewlet(self.portal, self.request, None)
     dsv.update()
     rendered = dsv.render()
     self.assertFalse(dsv.rapido_available)
     try:
         self.assertNotIn('PLONE_THEMING_RAPIDO_AVAILABLE', rendered)
     except AttributeError:
         self.assertFalse('PLONE_THEMING_RAPIDO_AVAILABLE' in rendered)
Esempio n. 7
0
 def test_diazo_snippet_debug(self):
     """Validate the 'debug' attribute."""
     dsv = DiazoSnippetViewlet(self.portal, self.request, None)
     dsv.update()
     rendered = dsv.render()
     self.assertFalse(dsv.debug)
     try:
         self.assertNotIn('PLONE_THEMING_DEBUG', rendered)
     except AttributeError:
         self.assertFalse('PLONE_THEMING_DEBUG' in rendered)
Esempio n. 8
0
 def test_diazo_snippet_hide_colophon(self):
     """Validate the 'hide_colophon' attribute."""
     dsv = DiazoSnippetViewlet(self.portal, self.request, None)
     dsv.update()
     rendered = dsv.render()
     self.assertFalse(dsv.hide_colophon)
     try:
         self.assertNotIn('PLONE_THEMING_HIDE_COLOPHON', rendered)
     except AttributeError:
         self.assertFalse('PLONE_THEMING_HIDE_COLOPHON' in rendered)
Esempio n. 9
0
 def test_diazo_snippet_favicon_set(self):
     """Validate the 'favicon' attribute."""
     dsv = DiazoSnippetViewlet(self.portal, self.request, None)
     dsv.update()
     ploneapi.portal.set_registry_record(
         name='site_favicon',
         value=SITE_FAVICON_B64,
         interface=IPloneThemeSettings,
     )
     url = '{0}/@@site-favicon/pixel.png'.format(self.portal.absolute_url())
     self.assertEqual(dsv.favicon, url)
Esempio n. 10
0
 def test_diazo_snippet_phone_number_set(self):
     """Validate the 'phone_number' attribute."""
     dsv = DiazoSnippetViewlet(self.portal, self.request, None)
     dsv.update()
     ploneapi.portal.set_registry_record(
         name='phone_number',
         value=u'+1 (234) 567-890',
         interface=IPloneThemeSettings,
     )
     self.assertEqual(dsv.phone_number, u'+1 (234) 567-890')
     self.assertEqual(dsv.phone_number_raw, u'001234567890')
Esempio n. 11
0
 def test_diazo_snippet_plone_version(self):
     """Validate the 'plone_version' attribute."""
     dsv = DiazoSnippetViewlet(self.portal, self.request, None)
     dsv.update()
     rendered = dsv.render()
     version = ploneapi.env.plone_version()[:1]
     self.assertEqual(dsv.plone_version, version)
     snippet_id = '_'.join(['PLONE_THEMING_PLONE_VERSION', version])
     try:
         self.assertIn(snippet_id, rendered)
     except AttributeError:
         self.assertTrue(snippet_id in rendered)
Esempio n. 12
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)
Esempio n. 13
0
 def test_diazo_snippet_themefragments_available(self):
     """Validate the 'themefragments_available' attribute."""
     dsv = DiazoSnippetViewlet(self.portal, self.request, None)
     dsv.update()
     rendered = dsv.render()
     self.assertFalse(dsv.themefragments_available)
     try:
         self.assertNotIn(
             'PLONE_THEMING_THEMEFRAGMENTS_AVAILABLE',
             rendered,
         )
     except AttributeError:
         self.assertFalse(
             'PLONE_THEMING_THEMEFRAGMENTS_AVAILABLE' in rendered,
         )
Esempio n. 14
0
 def test_diazo_snippets_debug_style_set(self):
     """Validate that the diazo snippet viewlet applies correct CSS."""
     dsv = DiazoSnippetViewlet(self.portal, self.request, None)
     dsv.update()
     ploneapi.portal.set_registry_record(
         name='debug',
         value=True,
         interface=IPloneThemeSettings,
     )
     rendered = dsv.render()
     self.assertEqual(dsv.debug_style, 'block')
     try:
         self.assertIn('style="display: block"', rendered)
     except AttributeError:
         self.assertTrue('style="display: block"' in rendered)
Esempio n. 15
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')
Esempio n. 16
0
 def test_diazo_debug_set(self):
     """Validate the 'debug' attribute."""
     dsv = DiazoSnippetViewlet(self.portal, self.request, None)
     dsv.update()
     ploneapi.portal.set_registry_record(
         name='debug',
         value=True,
         interface=IPloneThemeSettings,
     )
     rendered = dsv.render()
     self.assertTrue(dsv.debug)
     try:
         self.assertIn('PLONE_THEMING_DEBUG', rendered)
     except AttributeError:
         self.assertTrue('PLONE_THEMING_DEBUG' in rendered)
Esempio n. 17
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)
Esempio n. 18
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)
Esempio n. 19
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)
Esempio n. 20
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)
Esempio n. 21
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)
Esempio n. 22
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)
Esempio n. 23
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)
Esempio n. 24
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)