def test_as_action_enabled(self):
     """ Enable viewlet as document action
     """
     self._enable_sb_action()
     viewlet = SocialBookmarksViewlet(self.page, self.request, None)
     viewlet.update()
     self.assertEqual(viewlet.action_enabled, True)
示例#2
0
 def test_wrong_provider(self):
     """Deal with a wrong provider set on the registry"""
     self.set_up_social_bookmarks(providers=("foo", ))
     viewlet = SocialBookmarksViewlet(self.page, self.request, None)
     viewlet.update()
     html = viewlet.render()
     self.assertFalse("foo" in html)
 def test_viewlet_enabled_anonymous(self):
     """ Enabled for pages, even for anonymous
     """
     logout()
     viewlet = SocialBookmarksViewlet(self.page, self.request, None)
     viewlet.update()
     self.assertEqual(viewlet.enabled, True)
 def test_wrong_provider(self):
     """ Deal with a wrong provider set on the registry
     """
     self.set_up_social_bookmarks(providers=('foo', ))
     viewlet = SocialBookmarksViewlet(self.page, self.request, None)
     viewlet.update()
     html = viewlet.render()
     self.assertFalse('foo' in html)
示例#5
0
    def test_rendering(self):
        """Validate if Reddit is rendered as an option"""
        viewlet = SocialBookmarksViewlet(self.page, self.request, None)
        viewlet.update()
        html = viewlet.render()
        self.assertTrue("Reddit" in html)

        expected = "http://reddit.com/submit?url=http://nohost"
        self.assertTrue(expected in html)
    def test_rendering(self):
        """ Validate if Reddit is rendered as an option
        """
        viewlet = SocialBookmarksViewlet(self.page, self.request, None)
        viewlet.update()
        html = viewlet.render()
        self.assertTrue('Reddit' in html)

        expected = "http://reddit.com/submit?url=http://nohost"
        self.assertTrue(expected in html)
示例#7
0
    def test_provider_without_url(self):
        """Deal with a provider set without an url template"""
        from plone.registry import field
        from plone.registry.record import Record

        reg = self.reg
        value = {u"url": u"", u"logo": u"", u"id": u"foo"}
        record = Record(field.Dict(title=u"Foo"), value)
        reg.records["sc.social.bookmarks.providers.foo"] = record
        self.set_up_social_bookmarks(providers=("foo", ))
        viewlet = SocialBookmarksViewlet(self.page, self.request, None)
        viewlet.update()
        html = viewlet.render()
        self.assertFalse("foo" in html)
 def test_provider_without_url(self):
     """ Deal with a provider set without an url template
     """
     from plone.registry import field
     from plone.registry.record import Record
     reg = self.reg
     value = {u'url': u'', u'logo': u'', u'id': u'foo'}
     record = Record(field.Dict(title=u"Foo"), value)
     reg.records['sc.social.bookmarks.providers.foo'] = record
     self.set_up_social_bookmarks(providers=('foo', ))
     viewlet = SocialBookmarksViewlet(self.page, self.request, None)
     viewlet.update()
     html = viewlet.render()
     self.assertFalse('foo' in html)
示例#9
0
 def test_as_action_enabled(self):
     """Enable viewlet as document action"""
     self._enable_sb_action()
     viewlet = SocialBookmarksViewlet(self.page, self.request, None)
     viewlet.update()
     self.assertEqual(viewlet.action_enabled, True)
示例#10
0
 def test_as_action_not_enabled(self):
     """Viewlet display as document action is not available by default"""
     viewlet = SocialBookmarksViewlet(self.page, self.request, None)
     viewlet.update()
     self.assertEqual(viewlet.action_enabled, False)
示例#11
0
 def test_viewlet_enabled_anonymous(self):
     """Enabled for pages, even for anonymous"""
     logout()
     viewlet = SocialBookmarksViewlet(self.page, self.request, None)
     viewlet.update()
     self.assertEqual(viewlet.enabled, True)
示例#12
0
 def test_viewlet_enabled(self):
     """Enabled for pages"""
     viewlet = SocialBookmarksViewlet(self.page, self.request, None)
     viewlet.update()
     self.assertEqual(viewlet.enabled, True)
示例#13
0
 def test_viewlet_not_enabled(self):
     """Not enabled for folders"""
     viewlet = SocialBookmarksViewlet(self.folder, self.request, None)
     viewlet.update()
     self.assertEqual(viewlet.enabled, False)
 def test_as_action_not_enabled(self):
     """ Viewlet display as document action is not available by default
     """
     viewlet = SocialBookmarksViewlet(self.page, self.request, None)
     viewlet.update()
     self.assertEqual(viewlet.action_enabled, False)
 def test_viewlet_enabled(self):
     """ Enabled for pages
     """
     viewlet = SocialBookmarksViewlet(self.page, self.request, None)
     viewlet.update()
     self.assertEqual(viewlet.enabled, True)
 def test_viewlet_not_enabled(self):
     """ Not enabled for folders
     """
     viewlet = SocialBookmarksViewlet(self.folder, self.request, None)
     viewlet.update()
     self.assertEqual(viewlet.enabled, False)