def test_addNyExpert_duplicates(self):
     self.login("contributor")
     expert_item.addNyExpert(self.app.portal.test_folder, id="expertdup1", name="expertdup1", surname="expertdup1")
     self.assertTrue(hasattr(self.app.portal.test_folder, "expertdup1"), "Expert object expertdup1 was not found in folder 'test_folder'")
     expert_item.addNyExpert(self.app.portal.test_folder, id="expertdup1", name="expertdup1", surname="expertdup1")
     self.assertTrue(hasattr(self.app.portal.test_folder, "expertdup1-1"), "Expert object expertdup1 was not found in folder 'test_folder'")
     self.logout()
Esempio n. 2
0
    def test_main(self):
        """ Add, Find, Edit and Delete Naaya Experts """
        #add NyExpert
        addNyExpert(self._portal().info,
                    id='expert',
                    name='Expert Name',
                    surname='Expert Surname')

        meta = self._portal().getCatalogedObjectsCheckView(
            meta_type=['Naaya Expert'])

        #get added NyExpert
        for x in meta:
            if x.name == 'Expert Name':
                meta = x

        self.assertEqual(meta.name, 'Expert Name')

        #change NyExpert name
        meta.saveProperties(name='Expert Name edited',
                            surname='Expert Surname edited')

        self.assertEqual(meta.name, 'Expert Name edited')

        self.assertEqual(meta.sortorder, 100)

        #delete NyExpert
        self._portal().info.manage_delObjects([meta.id])

        meta = self._portal().getCatalogedObjectsCheckView(
            meta_type=['Naaya Expert'])
        self.assertEqual(meta, [])
 def test_main(self):
     """ Add, Find, Edit and Delete Naaya Experts """
     #add NyExpert
     addNyExpert(self._portal().info, id='expert', name='Expert Name', surname='Expert Surname')
     
     meta = self._portal().getCatalogedObjectsCheckView(meta_type=['Naaya Expert'])
     
     #get added NyExpert
     for x in meta:
         if x.name == 'Expert Name':
             meta = x
     
     self.assertEqual(meta.name, 'Expert Name')
     
     #change NyExpert name
     meta.saveProperties(name='Expert Name edited', surname='Expert Surname edited')
     
     self.assertEqual(meta.name, 'Expert Name edited')
     
     self.assertEqual(meta.sortorder, 100)
     
     #delete NyExpert
     self._portal().info.manage_delObjects([meta.id])
     
     meta = self._portal().getCatalogedObjectsCheckView(meta_type=['Naaya Expert'])
     self.assertEqual(meta, [])
Esempio n. 4
0
 def test_addNyExpert_nologin(self):
     """
     Test adding Expert without being logged in
     """
     expert_item.addNyExpert(self.app.portal.test_folder,
                             name="Name",
                             surname="Surname")
     self.assertFalse(hasattr(self.app.portal.test_folder, "Name"))
 def afterSetUp(self):
     self.install_content_type('Naaya Expert')
     setUp_EW_data(self.portal)
     from Products.Naaya.NyFolder import addNyFolder
     from naaya.content.expert.expert_item import addNyExpert
     from Products.NaayaGlossary.NyGlossary import manage_addGlossaryCentre
     addNyFolder(self.portal, 'myfolder', contributor='contributor', submitted=1)
     addNyExpert(self.portal.myfolder, id='myexpert', name='My expert',
         surname='Knowitall', submitted=1, contributor='contributor')
     manage_addGlossaryCentre(self.portal, 'chm_terms')
     transaction.commit()
Esempio n. 6
0
 def test_addNyExpert_no_requiredattrs(self):
     self.login("contributor")
     self.failUnlessRaises(
         ValueError,
         lambda: expert_item.addNyExpert(self.app.portal.test_folder))
     self.assertFalse(hasattr(self.app.portal.test_folder, "testExpert"))
     self.logout()
Esempio n. 7
0
 def test_addNyExpert_duplicates(self):
     self.login("contributor")
     expert_item.addNyExpert(self.app.portal.test_folder,
                             id="expertdup1",
                             name="expertdup1",
                             surname="expertdup1")
     self.assertTrue(
         hasattr(self.app.portal.test_folder, "expertdup1"),
         "Expert object expertdup1 was not found in folder 'test_folder'")
     expert_item.addNyExpert(self.app.portal.test_folder,
                             id="expertdup1",
                             name="expertdup1",
                             surname="expertdup1")
     self.assertTrue(
         hasattr(self.app.portal.test_folder, "expertdup1-1"),
         "Expert object expertdup1 was not found in folder 'test_folder'")
     self.logout()
Esempio n. 8
0
 def afterSetUp(self):
     self.install_content_type('Naaya Expert')
     setUp_EW_data(self.portal)
     from Products.Naaya.NyFolder import addNyFolder
     from naaya.content.expert.expert_item import addNyExpert
     from Products.NaayaGlossary.NyGlossary import manage_addGlossaryCentre
     addNyFolder(self.portal,
                 'myfolder',
                 contributor='contributor',
                 submitted=1)
     addNyExpert(self.portal.myfolder,
                 id='myexpert',
                 name='My expert',
                 surname='Knowitall',
                 submitted=1,
                 contributor='contributor')
     manage_addGlossaryCentre(self.portal, 'chm_terms')
     transaction.commit()
 def test_addNyExpert_has_requiredattrs(self):
     self.login("contributor")
     id = expert_item.addNyExpert(self.app.portal.test_folder, name="test1", surname="test1")
     self.assertTrue(hasattr(self.app.portal.test_folder, "test1-test1"), "Expert object test1-test1 was not found in folder 'test_folder'")
     meta = self._portal().getCatalogedObjectsCheckView(meta_type=["Naaya Expert"])
     test1 = None
     for expert in meta:
         if expert.title == "test1 test1":
             test1 = expert
     self.assertNotEqual(test1, None, "Expert not found via CatalogedObjectsCheckView")
     self.assertEqual(test1.title, "test1 test1")
     self.logout()
Esempio n. 10
0
 def test_addNyExpert_has_requiredattrs(self):
     self.login("contributor")
     id = expert_item.addNyExpert(self.app.portal.test_folder,
                                  name="test1",
                                  surname="test1")
     self.assertTrue(
         hasattr(self.app.portal.test_folder, "test1-test1"),
         "Expert object test1-test1 was not found in folder 'test_folder'")
     meta = self._portal().getCatalogedObjectsCheckView(
         meta_type=["Naaya Expert"])
     test1 = None
     for expert in meta:
         if expert.title == "test1 test1":
             test1 = expert
     self.assertNotEqual(test1, None,
                         "Expert not found via CatalogedObjectsCheckView")
     self.assertEqual(test1.title, "test1 test1")
     self.logout()
 def test_addNyExpert_no_requiredattrs(self):
     self.login("contributor")
     self.failUnlessRaises(ValueError, lambda: expert_item.addNyExpert(self.app.portal.test_folder))
     self.assertFalse(hasattr(self.app.portal.test_folder, "testExpert"))
     self.logout()
 def test_addNyExpert_nologin(self):
     """
     Test adding Expert without being logged in
     """
     expert_item.addNyExpert(self.app.portal.test_folder, name="Name", surname="Surname")
     self.assertFalse(hasattr(self.app.portal.test_folder, "Name"))