def test_add_content_provider_no_context(self):
     from zope.interface import implementedBy
     config = self._createConfigurator()
     config.add_content_provider(DummyContentProvider("content"),
                                 name="name")
     provider = self._getProvider("name")
     self.assertTrue(IContentProvider.providedBy(provider))
     self.assertEqual(provider(None, None), "content")
     provider = self._getProvider("name",
                                  context_iface=implementedBy(DummyContext))
     self.assertTrue(IContentProvider.providedBy(provider))
     self.assertEqual(provider(None, None), "content")
Example #2
0
 def test_contentprovider_no_context(self):
     context = DummyContext()
     self._callContentProvider(context, DummyProvider("content"), "name")
     self.assertEqual(len(context.actions), 1)
     action = context.actions[0]
     self.assertEqual(action["discriminator"], ("name",))
     register = action["callable"]
     register()
     provider = self._getProvider("name")
     self.assertNotEqual(provider, None)
     self.assertTrue(IContentProvider.providedBy(provider))
     self.assertEqual(provider(None, None), "content")