def test_main(self): """ Add, Find, Edit and Delete Naaya Events """ #add NyEvent addNyEvent(self._portal().info, id='event1', title='event1', lang='en') addNyEvent(self._portal().info, id='event1_fr', title='event1_fr', lang='fr') meta = self._portal().getCatalogedObjectsCheckView(meta_type=['Naaya Event']) #get added NyEvent for x in meta: if x.getLocalProperty('title', 'en') == 'event1': meta = x if x.getLocalProperty('title', 'fr') == 'event1_fr': meta_fr = x self.assertEqual(meta.getLocalProperty('title', 'en'), 'event1') self.assertEqual(meta_fr.getLocalProperty('title', 'fr'), 'event1_fr') #change NyEvent title meta.saveProperties(title='event1_edited', lang='en') meta_fr.saveProperties(title='event1_fr_edited', lang='fr') self.assertEqual(meta.getLocalProperty('title', 'en'), 'event1_edited') self.assertEqual(meta_fr.getLocalProperty('title', 'fr'), 'event1_fr_edited') #delete NyEvent self._portal().info.manage_delObjects([meta.id]) self._portal().info.manage_delObjects([meta_fr.id]) meta = self._portal().getCatalogedObjectsCheckView(meta_type=['Naaya Event']) self.assertEqual(meta, [])
def test_NyEvent(self): """ Add, Find, Edit and Delete Naaya Events """ #add NyEvent addNyEvent(self.portal.folder_test, id='event1', title='event1', lang='en') addNyEvent(self.portal.folder_test, id='event1_fr', title='event1_fr', lang='fr') meta = self.portal.getCatalogedObjectsCheckView( meta_type=['Naaya Event']) #get added NyEvent for x in meta: if x.getLocalProperty('title', 'en') == 'event1': meta = x if x.getLocalProperty('title', 'fr') == 'event1_fr': meta_fr = x self.assertEqual(meta.getLocalProperty('title', 'en'), 'event1') self.assertEqual(meta_fr.getLocalProperty('title', 'fr'), 'event1_fr') #change NyEvent title meta.saveProperties(title='event1_edited', lang='en') meta_fr.saveProperties(title='event1_fr_edited', lang='fr') self.assertEqual(meta.getLocalProperty('title', 'en'), 'event1_edited') self.assertEqual(meta_fr.getLocalProperty('title', 'fr'), 'event1_fr_edited') #delete NyEvent self.portal.folder_test.manage_delObjects([meta.id]) self.portal.folder_test.manage_delObjects([meta_fr.id]) meta = self.portal.getCatalogedObjectsCheckView( meta_type=['Naaya Event']) self.assertEqual(meta, [])
def afterSetUp(self): portal = self.app.portal addNyFolder(portal, 'test_folder') addNyEvent(portal.test_folder, id='test_event', title='Test event')