示例#1
0
    def test_projects_container(self):
        from eportfolio.models.app import Application
        from eportfolio.views.container import remove_item

        root = Application()

        # Try to remove not existing project
        request = testing.DummyRequest(root=root)
        request.POST['item'] = 'test'
        response = remove_item(root['projects'], request)
        self.assertEquals(400, response.status_int)

        # Add project
        project = self._add_project()
        self.assertEquals(1, len(root['projects']))
        request.POST['item'] = project.id
        response = remove_item(root['projects'], request)
        self.assertEquals(200, response.status_int)
        self.assertEquals(0, len(root['projects']))
示例#2
0
 def test_projects_container(self):
     from eportfolio.models.app import Application
     from eportfolio.views.container import remove_item
     
     root = Application()
     
     # Try to remove not existing project
     request = testing.DummyRequest(root=root)
     request.POST['item'] = 'test'
     response = remove_item(root['projects'], request)
     self.assertEquals(400, response.status_int)
     
     # Add project
     project = self._add_project()
     self.assertEquals(1, len(root['projects']))
     request.POST['item'] = project.id
     response = remove_item(root['projects'], request)
     self.assertEquals(200, response.status_int)
     self.assertEquals(0, len(root['projects']))
     
示例#3
0
 def test_competences_container(self):
     from eportfolio.models.app import Application
     from eportfolio.views.container import remove_item
     
     root = Application()
     
     # Add competence
     meta_competence = self._add_meta_competence()
     competence = self._add_competence(meta_competence=meta_competence)
     self.assertEquals(1, len(root['competences']))
     # Remove competence
     request = testing.DummyRequest(root=root)
     request.POST['item'] = competence.id
     response = remove_item(root['competences'], request)
     self.assertEquals(200, response.status_int)
     self.assertEquals('success', response.body)
     self.assertEquals(0, len(root['competences']))