def test_main(self): """ Add, Find, Edit and Delete Naaya Blog Entries """ #add NyBlog addNyBlogEntry(self._portal().info, id='blog1', title='blog1', contributor='admin', lang='en', submitted=1) addNyBlogEntry(self._portal().info, id='blog1_fr', title='blog1_fr', contributor='admin', lang='fr', submitted=1) meta = self._portal().getCatalogedObjectsCheckView(meta_type=['Naaya Blog Entry']) #get added NyBlog for x in meta: if x.getLocalProperty('title', 'en') == 'blog1': meta = x if x.getLocalProperty('title', 'fr') == 'blog1_fr': meta_fr = x self.assertEqual(meta.getLocalProperty('title', 'en'), 'blog1') self.assertEqual(meta_fr.getLocalProperty('title', 'fr'), 'blog1_fr') #change NyBlog title meta.saveProperties(title='blog1_edited', lang='en') meta_fr.saveProperties(title='blog1_fr_edited', lang='fr') self.assertEqual(meta.getLocalProperty('title', 'en'), 'blog1_edited') self.assertEqual(meta_fr.getLocalProperty('title', 'fr'), 'blog1_fr_edited') #delete NyBlog self._portal().info.manage_delObjects([meta.id]) self._portal().info.manage_delObjects([meta_fr.id]) meta = self._portal().getCatalogedObjectsCheckView(meta_type=['Naaya Blog Entry']) self.assertEqual(meta, [])
def afterSetUp(self): self.portal.manage_install_pluggableitem('Naaya Blog Entry') from Products.Naaya.NyFolder import addNyFolder from Products.NaayaContent.NyBlogEntry.NyBlogEntry import addNyBlogEntry addNyFolder(self.portal, 'myfolder', contributor='contributor', submitted=1) self.portal.myfolder._Naaya___Add_Naaya_Blog_Entry_objects_Permission = ['Contributor',] addNyBlogEntry(self.portal.myfolder, id='myentry', title='My entry', submitted=1, contributor='contributor') import transaction; transaction.commit()
def afterSetUp(self): self.portal.manage_install_pluggableitem('Naaya Blog Entry') from Products.Naaya.NyFolder import addNyFolder from Products.NaayaContent.NyBlogEntry.NyBlogEntry import addNyBlogEntry addNyFolder(self.portal, 'myfolder', contributor='contributor', submitted=1) self.portal.myfolder._Naaya___Add_Naaya_Blog_Entry_objects_Permission = [ 'Contributor', ] addNyBlogEntry(self.portal.myfolder, id='myentry', title='My entry', submitted=1, contributor='contributor') import transaction transaction.commit()
def test_main(self): """ Add, Find, Edit and Delete Naaya Blog Entries """ #add NyBlog addNyBlogEntry(self._portal().info, id='blog1', title='blog1', contributor='admin', lang='en', submitted=1) addNyBlogEntry(self._portal().info, id='blog1_fr', title='blog1_fr', contributor='admin', lang='fr', submitted=1) meta = self._portal().getCatalogedObjectsCheckView( meta_type=['Naaya Blog Entry']) #get added NyBlog for x in meta: if x.getLocalProperty('title', 'en') == 'blog1': meta = x if x.getLocalProperty('title', 'fr') == 'blog1_fr': meta_fr = x self.assertEqual(meta.getLocalProperty('title', 'en'), 'blog1') self.assertEqual(meta_fr.getLocalProperty('title', 'fr'), 'blog1_fr') #change NyBlog title meta.saveProperties(title='blog1_edited', lang='en') meta_fr.saveProperties(title='blog1_fr_edited', lang='fr') self.assertEqual(meta.getLocalProperty('title', 'en'), 'blog1_edited') self.assertEqual(meta_fr.getLocalProperty('title', 'fr'), 'blog1_fr_edited') #delete NyBlog self._portal().info.manage_delObjects([meta.id]) self._portal().info.manage_delObjects([meta_fr.id]) meta = self._portal().getCatalogedObjectsCheckView( meta_type=['Naaya Blog Entry']) self.assertEqual(meta, [])