Example #1
0
    def test_main(self):
        """ Add, Find, Edit and Delete Naaya Projects """
        #add NyProject
        addNyProject(self._portal().info, id='project', title='Project Title')

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

        #get added NyProject
        for x in meta:
            if x.title == 'Project Title':
                meta = x

        self.assertEqual(meta.title, 'Project Title')

        #change NyProject title
        meta.saveProperties(title='Project Title edited')

        self.assertEqual(meta.title, 'Project Title edited')

        self.assertEqual(meta.sortorder, 100)

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

        meta = self._portal().getCatalogedObjectsCheckView(
            meta_type=['Naaya Project'])
        self.assertEqual(meta, [])
 def test_addNyProject_duplicates(self):
     self.login("contributor")
     project_item.addNyProject(self.app.portal.test_folder, id="projectdup1", title="projectdup1")
     self.assertTrue(hasattr(self.app.portal.test_folder, "projectdup1"), "Project object projectdup1 was not found in folder 'test_folder'")
     project_item.addNyProject(self.app.portal.test_folder, id="projectdup1", title="projectdup1")
     self.assertTrue(hasattr(self.app.portal.test_folder, "projectdup1-1"), "Project object projectdup1 was not found in folder 'test_folder'")
     self.logout()
 def afterSetUp(self):
     self.install_content_type('Naaya Project')
     from Products.Naaya.NyFolder import addNyFolder
     from naaya.content.project.project_item import addNyProject
     from Products.NaayaGlossary.NyGlossary import manage_addGlossaryCentre
     addNyFolder(self.portal, 'myfolder', contributor='contributor', submitted=1)
     addNyProject(self.portal.myfolder, id='myproject', title='My project', submitted=1, contributor='contributor')
     manage_addGlossaryCentre(self.portal, 'chm_terms')
     transaction.commit()
Example #4
0
 def test_addNyProject_duplicates(self):
     self.login("contributor")
     project_item.addNyProject(self.app.portal.test_folder,
                               id="projectdup1",
                               title="projectdup1")
     self.assertTrue(
         hasattr(self.app.portal.test_folder, "projectdup1"),
         "Project object projectdup1 was not found in folder 'test_folder'")
     project_item.addNyProject(self.app.portal.test_folder,
                               id="projectdup1",
                               title="projectdup1")
     self.assertTrue(
         hasattr(self.app.portal.test_folder, "projectdup1-1"),
         "Project object projectdup1 was not found in folder 'test_folder'")
     self.logout()
Example #5
0
 def afterSetUp(self):
     self.install_content_type('Naaya Project')
     from Products.Naaya.NyFolder import addNyFolder
     from naaya.content.project.project_item import addNyProject
     from Products.NaayaGlossary.NyGlossary import manage_addGlossaryCentre
     addNyFolder(self.portal,
                 'myfolder',
                 contributor='contributor',
                 submitted=1)
     addNyProject(self.portal.myfolder,
                  id='myproject',
                  title='My project',
                  submitted=1,
                  contributor='contributor')
     manage_addGlossaryCentre(self.portal, 'chm_terms')
     transaction.commit()
Example #6
0
 def test_addNyProject_no_requiredattrs(self):
     self.login("contributor")
     self.failUnlessRaises(
         ValueError,
         lambda: project_item.addNyProject(self.app.portal.test_folder))
     self.assertFalse(hasattr(self.app.portal.test_folder, "testProject"))
     self.logout()
 def test_addNyProject_has_requiredattrs(self):
     self.login("contributor")
     id = project_item.addNyProject(self.app.portal.test_folder, title="test1")
     self.assertTrue(hasattr(self.app.portal.test_folder, "test1"), "Project object test1-test1 was not found in folder 'test_folder'")
     meta = self._portal().getCatalogedObjectsCheckView(meta_type=["Naaya Project"])
     test1 = None
     for project in meta:
         if project.title == "test1":
             test1 = project
     self.assertNotEqual(test1, None, "Project not found via CatalogedObjectsCheckView")
     self.assertEqual(test1.title, "test1")
     self.logout()
Example #8
0
 def test_addNyProject_has_requiredattrs(self):
     self.login("contributor")
     id = project_item.addNyProject(self.app.portal.test_folder,
                                    title="test1")
     self.assertTrue(
         hasattr(self.app.portal.test_folder, "test1"),
         "Project object test1-test1 was not found in folder 'test_folder'")
     meta = self._portal().getCatalogedObjectsCheckView(
         meta_type=["Naaya Project"])
     test1 = None
     for project in meta:
         if project.title == "test1":
             test1 = project
     self.assertNotEqual(test1, None,
                         "Project not found via CatalogedObjectsCheckView")
     self.assertEqual(test1.title, "test1")
     self.logout()
 def test_addNyProject_no_requiredattrs(self):
     self.login("contributor")
     self.failUnlessRaises(ValueError, lambda: project_item.addNyProject(self.app.portal.test_folder))
     self.assertFalse(hasattr(self.app.portal.test_folder, "testProject"))
     self.logout()
 def test_addNyProject_nologin(self):
     """
     Test adding Project without being logged in
     """
     project_item.addNyProject(self.app.portal.test_folder, title="Title")
     self.assertFalse(hasattr(self.app.portal.test_folder, "Title"))
Example #11
0
 def test_addNyProject_nologin(self):
     """
     Test adding Project without being logged in
     """
     project_item.addNyProject(self.app.portal.test_folder, title="Title")
     self.assertFalse(hasattr(self.app.portal.test_folder, "Title"))