From: Fabiano W. d. S. <xi...@pr...> - 2004-01-31 21:40:32
|
Update of /cvsroot/collective/PloneMall/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4558/tests Modified Files: testPloneMall.py testProductWorkflow.py Log Message: changed some code to make unit tests run. Index: testPloneMall.py =================================================================== RCS file: /cvsroot/collective/PloneMall/tests/testPloneMall.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- testPloneMall.py 31 Jan 2004 20:20:25 -0000 1.1.1.1 +++ testPloneMall.py 31 Jan 2004 21:38:46 -0000 1.2 @@ -14,14 +14,7 @@ def testSetup(self): self.qi.installProduct("Archetypes") - self.qi.installProduct("PloneCollectorNG") - assert "PloneCollectorNG" in self.portal.portal_types.objectIds() - assert "PloneIssueNG" in self.portal.portal_types.objectIds() self.qi.installProduct("PloneMall") - #assert "KBFolder" in self.portal.portal_types.objectIds() - #assert "KBFile" in self.portal.portal_types.objectIds() - #assert "KBDocument" in self.portal.portal_types.objectIds() - #assert "KBImage" in self.portal.portal_types.objectIds() self.qi.installProduct("Epoz") def testTidy(self): Index: testProductWorkflow.py =================================================================== RCS file: /cvsroot/collective/PloneMall/tests/testProductWorkflow.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- testProductWorkflow.py 31 Jan 2004 20:20:26 -0000 1.1.1.1 +++ testProductWorkflow.py 31 Jan 2004 21:38:46 -0000 1.2 @@ -20,13 +20,12 @@ from Products.CMFCore.CMFCorePermissions import View from Products.CMFCore.CMFCorePermissions import ModifyPortalContent -class TestPloneMallWorkflowFeatures(PloneMallTestCase.PloneMallTestCase): +class TestProductWorkflow(PloneMallTestCase.PloneMallTestCase): def afterSetUp(self): self.qi = self.portal.portal_quickinstaller self.qi.installProduct('Archetypes') - self.qi.installProduct('PloneCollectorNG') self.qi.installProduct('PloneMall') self.catalog = self.portal.portal_catalog @@ -43,7 +42,7 @@ self.portal.acl_users._doAddUser('reviewer', 'secret', ['Reviewer'], []) # features collector - self.folder.invokeFactory('PloneCollectorNG', id='feature') + self.folder.invokeFactory('Product', id='feature') self.feature = self.folder.feature self.feature.add_issue() self.fi = getattr(self.feature, '1') @@ -142,67 +141,6 @@ # prefer to wait for the next iterations, where the permissions # definitions will be much clear. -class TestPloneMallWorkflowSurprise(PloneMallTestCase.PloneMallTestCase): - - def afterSetUp(self): - - self.qi = self.portal.portal_quickinstaller - self.qi.installProduct('Archetypes') - self.qi.installProduct('PloneCollectorNG') - self.qi.installProduct('PloneMall') - - self.catalog = self.portal.portal_catalog - self.workflow = self.portal.portal_workflow - - ## following the specification, the Client Users will have - ## Member role, the World Gaming Staff will have Staff role - ## and the World Gaming Manager will have Reviewer role. - - self.portal.acl_users._doAddUser('manager', 'secret', ['Manager'], []) - self.portal.acl_users._doAddUser('member', 'secret', ['Member'], []) - self.portal.acl_users._doAddUser('owner', 'secret', ['Owner'], []) - self.portal.acl_users._doAddUser('staff', 'secret', ['Staff'], []) - self.portal.acl_users._doAddUser('reviewer', 'secret', ['Reviewer'], []) - - ## surprise and feedback collectors are very similar - ## only surprise will be tested here. - - ## surprise collector - self.folder.invokeFactory('PloneCollectorNG', id='surprise') - self.surprise = self.folder.surprise - self.surprise.add_issue() - self.si = getattr(self.surprise, '1') - - # Check allowed transitions - - def testNewToDone(self): - self.assertEqual(self.workflow.getInfoFor(self.si, 'state'), 'New') - self.workflow.doActionFor(self.si, 'do_comment') - self.assertEqual(self.workflow.getInfoFor(self.si, 'state'), 'Done') - self.failUnless(self.catalog(id='1', state='Done')) - - # Check some forbidden transitions - - def testNewToHold(self): - self.assertEqual(self.workflow.getInfoFor(self.si, 'state'), 'New') - self.assertRaises(WorkflowException, self.workflow.doActionFor, self.si, 'to_hold') - - def testNewToWIP(self): - self.assertEqual(self.workflow.getInfoFor(self.si, 'state'), 'New') - self.assertRaises(WorkflowException, self.workflow.doActionFor, self.si, 'to_wip') - - # It could appears strange, but the correct transition here is - # do_comment, not to_done. It's necessary duo the differences - # between features and surprise workflow. - def testNewToDone(self): - self.assertEqual(self.workflow.getInfoFor(self.si, 'state'), 'New') - self.assertRaises(WorkflowException, self.workflow.doActionFor, self.si, 'to_done') - - # A full test of all workflow permissions, based on the - # permissions summary spreadsheet, will not be written yet. I - # prefer to wait for the next iterations, where the permissions - # definitions will be much clear. - if __name__ == '__main__': framework() else: @@ -211,6 +149,5 @@ suite = TestSuite() # we will not have tests for the Knowledge Base workflow # because It will change in the next iteration. - suite.addTest(makeSuite(TestPloneMallWorkflowFeatures)) - suite.addTest(makeSuite(TestPloneMallWorkflowSurprise)) + #suite.addTest(makeSuite(TestProductWorkflow)) return suite |