def afterSetUp(self): from Products.Naaya.NyFolder import addNyFolder from Products.NaayaContent.NyURL.NyURL import addNyURL addNyFolder(self.portal, 'myfolder', contributor='contributor', submitted=1) addNyURL(self.portal.myfolder, id='myurl', title='My url', locator='http://www.eaudeweb.ro', submitted=1, contributor='contributor') import transaction; transaction.commit()
def test_main(self): """ Add, Find, Edit and Delete Naaya URLs """ #add NyURL addNyURL(self._portal().info, id='url1', title='url1', lang='en') addNyURL(self._portal().info, id='url1_fr', title='url1_fr', lang='fr') meta = self._portal().getCatalogedObjectsCheckView(meta_type=['Naaya URL']) #get added NyURL for x in meta: if x.getLocalProperty('title', 'en') == 'url1': meta = x if x.getLocalProperty('title', 'fr') == 'url1_fr': meta_fr = x self.assertEqual(meta.getLocalProperty('title', 'en'), 'url1') self.assertEqual(meta_fr.getLocalProperty('title', 'fr'), 'url1_fr') #change NyURL title meta.saveProperties(title='url1_edited', lang='en') meta_fr.saveProperties(title='url1_fr_edited', lang='fr') self.assertEqual(meta.getLocalProperty('title', 'en'), 'url1_edited') self.assertEqual(meta_fr.getLocalProperty('title', 'fr'), 'url1_fr_edited') #delete NyURL self._portal().info.manage_delObjects([meta.id]) self._portal().info.manage_delObjects([meta_fr.id]) meta = self._portal().getCatalogedObjectsCheckView(meta_type=['Naaya URL']) self.assertEqual(meta, [])
def test_NyURL(self): """ Add, Find, Edit and Delete Naaya URLs """ #add NyURL addNyURL(self.portal.folder_test, id='url1', title='url1', lang='en') addNyURL(self.portal.folder_test, id='url1_fr', title='url1_fr', lang='fr') meta = self.portal.getCatalogedObjectsCheckView( meta_type=['Naaya URL']) #get added NyURL for x in meta: if x.getLocalProperty('title', 'en') == 'url1': meta = x if x.getLocalProperty('title', 'fr') == 'url1_fr': meta_fr = x self.assertEqual(meta.getLocalProperty('title', 'en'), 'url1') self.assertEqual(meta_fr.getLocalProperty('title', 'fr'), 'url1_fr') #change NyURL title meta.saveProperties(title='url1_edited', lang='en') meta_fr.saveProperties(title='url1_fr_edited', lang='fr') self.assertEqual(meta.getLocalProperty('title', 'en'), 'url1_edited') self.assertEqual(meta_fr.getLocalProperty('title', 'fr'), 'url1_fr_edited') #delete NyURL self.portal.folder_test.manage_delObjects([meta.id]) self.portal.folder_test.manage_delObjects([meta_fr.id]) meta = self.portal.getCatalogedObjectsCheckView( meta_type=['Naaya URL']) self.assertEqual(meta, [])
def afterSetUp(self): portal = self.app.portal addNyFolder(portal, "test_folder") addNyURL(portal.test_folder, id="test_url", title="test_url")