def test_adding(self): #Adding to self.portal and to self.folder raises ValueError self.assertRaises(ValueError, self.portal.invokeFactory, *('collective.composition.htmlfragment', 'hf1')) self.assertRaises(ValueError, self.folder.invokeFactory, *('collective.composition.htmlfragment', 'hf1')) #So, first we need to add the the composition container self.folder.invokeFactory('collective.composition.composition', 'c1') c1 = self.folder['c1'] #Now we can add the htmlfragment to the composition c1.invokeFactory('collective.composition.htmlfragment', 'hf1') hf1 = c1['hf1'] #Now test self.failUnless(IHTMLFragment.providedBy(hf1))
def test_adding(self): #Adding to self.portal and to self.folder raises ValueError self.assertRaises( ValueError, self.portal.invokeFactory, *('collective.composition.htmlfragment', 'hf1') ) self.assertRaises( ValueError, self.folder.invokeFactory, *('collective.composition.htmlfragment', 'hf1') ) #So, first we need to add the the composition container self.folder.invokeFactory('collective.composition.composition', 'c1') c1 = self.folder['c1'] #Now we can add the htmlfragment to the composition c1.invokeFactory('collective.composition.htmlfragment', 'hf1') hf1 = c1['hf1'] #Now test self.failUnless(IHTMLFragment.providedBy(hf1))
def test_factory(self): fti = queryUtility(IDexterityFTI, name='collective.composition.htmlfragment') factory = fti.factory new_object = createObject(factory) self.failUnless(IHTMLFragment.providedBy(new_object))