def test_adding(self): # we can add PSJMagazineContainer instances self.folder.invokeFactory( 'psj.content.magcontainer', 'doc1', title=u'My Doc', description=u'My description.', psj_title=u'My Title', psj_subtitle=u'My Subtitle', psj_publication_year=u"2014", psj_urn=u'My Identifier', ) d1 = self.folder['doc1'] self.assertTrue(IPSJMagazineContainer.providedBy(d1)) self.assertEqual(d1.title, u'My Doc') self.assertEqual(d1.description, u'My description.') # additional attributes were set self.assertEqual(d1.psj_title, u'My Title') self.assertEqual(d1.psj_subtitle, u'My Subtitle') self.assertEqual(d1.psj_publication_year, u'2014') self.assertEqual(d1.psj_urn, u'My Identifier')
def test_factory(self): # our fti provides a factory for PSJMagazineContainer instances fti = queryUtility(IDexterityFTI, name='psj.content.magcontainer') factory = fti.factory new_obj = createObject(factory) self.assertTrue(IPSJMagazineContainer.providedBy(new_obj))