From: Stefan H. H. <sh...@us...> - 2003-09-23 18:28:03
|
Update of /cvsroot/plone/CMFPlone/tests In directory sc8-pr-cvs1:/tmp/cvs-serv8615 Modified Files: testActionsTool.py testCatalogTool.py testContentTypeScripts.py testDefaultWorkflow.py testFolderLocalRoleForm.py testInterfaceTool.py testMemberDataTool.py testMembershipTool.py testPloneTestCase.py testPortalCreation.py testQuickInstallerTool.py testSkeletonPloneTest.py testSkeletonZopeTest.py testUserFolderBasics.py Log Message: Tests are now formatted in a slightly different way: - A test method should _not_ have a docstring - A test method should _not_ use plain 'assert' but the PyUnit API (self.failIf, self.failUnless, self.assertEqual, ...) These changes improve the quality of error reports and incidentally match the policies of Zope3 tests. ;-) Index: testPloneTestCase.py =================================================================== RCS file: /cvsroot/plone/CMFPlone/tests/testPloneTestCase.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- testPloneTestCase.py 15 Sep 2003 15:26:24 -0000 1.4 +++ testPloneTestCase.py 23 Sep 2003 18:27:58 -0000 1.5 @@ -9,6 +9,8 @@ from Testing import ZopeTestCase from Products.CMFPlone.tests import PloneTestCase +from Acquisition import aq_base + class TestPloneTestCase(PloneTestCase.PloneTestCase): @@ -17,44 +19,42 @@ self.workflow = self.portal.portal_workflow def testAddDocument(self): - assert not self.catalog(id='new') + self.failIf(self.catalog(id='new')) self.folder.invokeFactory('Document', id='new') - assert hasattr(self.folder.aq_base, 'new') - assert self.catalog(id='new') + self.failUnless(hasattr(aq_base(self.folder), 'new')) + self.failUnless(self.catalog(id='new')) def testPublishDocument(self): self.folder.invokeFactory('Document', id='new') - assert self.workflow.getInfoFor(self.folder.new, 'review_state') == 'visible' - assert not self.catalog(id='new', review_state='published') self.setRoles(['Reviewer']) self.workflow.doActionFor(self.folder.new, 'publish') - assert self.workflow.getInfoFor(self.folder.new, 'review_state') == 'published' - assert self.catalog(id='new', review_state='published') + self.assertEqual(self.workflow.getInfoFor(self.folder.new, 'review_state'), 'published') + self.failUnless(self.catalog(id='new', review_state='published')) def testRetractDocument(self): self.folder.invokeFactory('Document', id='new') self.setRoles(['Reviewer']) self.workflow.doActionFor(self.folder.new, 'publish') - assert self.workflow.getInfoFor(self.folder.new, 'review_state') == 'published' + self.assertEqual(self.workflow.getInfoFor(self.folder.new, 'review_state'), 'published') self.setRoles(['Member']) self.workflow.doActionFor(self.folder.new, 'retract') - assert self.workflow.getInfoFor(self.folder.new, 'review_state') == 'visible' + self.assertEqual(self.workflow.getInfoFor(self.folder.new, 'review_state'), 'visible') def testGetterSkinScript(self): self.folder.invokeFactory('Document', id='new', title='foo') - assert self.folder.new.TitleOrId() == 'foo' + self.assertEqual(self.folder.new.TitleOrId(), 'foo') def testSetterSkinScript(self): self.folder.invokeFactory('Document', id='new') - assert self.folder.new.EditableBody() == '' + self.assertEqual(self.folder.new.EditableBody(), '') self.folder.new.document_edit('plain', 'data') - assert self.folder.new.EditableBody() == 'data' + self.assertEqual(self.folder.new.EditableBody(), 'data') def testEditDocument(self): self.folder.invokeFactory('Document', id='new') - assert self.folder.new.EditableBody() == '' + self.assertEqual(self.folder.new.EditableBody(), '') self.folder.new.edit('plain', 'data', file='', safety_belt='') - assert self.folder.new.EditableBody() == 'data' + self.assertEqual(self.folder.new.EditableBody(), 'data') if __name__ == '__main__': Index: testUserFolderBasics.py =================================================================== RCS file: /cvsroot/plone/CMFPlone/tests/testUserFolderBasics.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- testUserFolderBasics.py 21 Sep 2003 22:29:26 -0000 1.1 +++ testUserFolderBasics.py 23 Sep 2003 18:27:58 -0000 1.2 @@ -54,61 +54,61 @@ '''Test UF is working''' def testGetUser(self): - assert self.uf.getUser(_user_name) is not None + self.failIf(self.uf.getUser(_user_name) is None) def testGetUsers(self): users = self.uf.getUsers() - assert users != [] - assert users[0].getUserName() == _user_name + self.failUnless(users) + self.assertEqual(users[0].getUserName(), _user_name) def testGetUserNames(self): names = self.uf.getUserNames() - assert names != [] - assert names[0] == _user_name + self.failUnless(names) + self.assertEqual(names[0], _user_name) def testIdentify(self): auth = self._basicAuth(_user_name) name, password = self.uf.identify(auth) - assert name is not None - assert name == _user_name - assert password is not None + self.failIf(name is None) + self.assertEqual(name, _user_name) + self.failIf(password is None) def testGetRoles(self): user = self.uf.getUser(_user_name) - assert _user_role in user.getRoles() + self.failUnless(_user_role in user.getRoles()) def testGetRolesInContext(self): user = self.uf.getUser(_user_name) self.folder.manage_addLocalRoles(_user_name, ['Owner']) roles = user.getRolesInContext(self.folder) - assert _user_role in roles - assert 'Owner' in roles + self.failUnless(_user_role in roles) + self.failUnless('Owner' in roles) def testHasRole(self): user = self.uf.getUser(_user_name) - assert user.has_role(_user_role, self.folder) + self.failUnless(user.has_role(_user_role, self.folder)) def testHasLocalRole(self): user = self.uf.getUser(_user_name) self.folder.manage_addLocalRoles(_user_name, ['Owner']) - assert user.has_role('Owner', self.folder) + self.failUnless(user.has_role('Owner', self.folder)) def testHasPermission(self): user = self.uf.getUser(_user_name) self.folder.manage_role(_user_role, _standard_permissions+['Add Folders']) self.login() # !!! Fixed in Zope 2.6.2 - assert user.has_permission('Add Folders', self.folder) + self.failUnless(user.has_permission('Add Folders', self.folder)) def testHasLocalPermission(self): user = self.uf.getUser(_user_name) self.folder.manage_role('Owner', ['Add Folders']) self.folder.manage_addLocalRoles(_user_name, ['Owner']) self.login() # !!! Fixed in Zope 2.6.2 - assert user.has_permission('Add Folders', self.folder) + self.failUnless(user.has_permission('Add Folders', self.folder)) def testAuthenticate(self): user = self.uf.getUser(_user_name) - assert user.authenticate('secret', self.app.REQUEST) + self.failUnless(user.authenticate('secret', self.app.REQUEST)) class TestUserFolderAccess(TestBase): @@ -142,26 +142,26 @@ request = self.app.REQUEST auth = self._basicAuth(_user_name) user = self.uf.validate(request, auth, [_user_role]) - assert user is not None - assert user.getUserName() == _user_name + self.failIf(user is None) + self.assertEqual(user.getUserName(), _user_name) def testNotAuthorize(self): # Validate should fail without auth request = self.app.REQUEST auth = '' - assert self.uf.validate(request, auth, [_user_role]) is None + self.assertEqual(self.uf.validate(request, auth, [_user_role]), None) def testNotAuthorize2(self): # Validate should fail without roles request = self.app.REQUEST auth = self._basicAuth(_user_name) - assert self.uf.validate(request, auth) is None + self.assertEqual(self.uf.validate(request, auth), None) def testNotAuthorize3(self): # Validate should fail with wrong roles request = self.app.REQUEST auth = self._basicAuth(_user_name) - assert self.uf.validate(request, auth, ['Manager']) is None + self.assertEqual(self.uf.validate(request, auth, ['Manager']), None) def testAuthorize2(self): # Validate should allow us to call dm @@ -169,8 +169,8 @@ auth = self._basicAuth(_user_name) roles = self._call__roles__(self.folder[_pm]) user = self.uf.validate(request, auth, roles) - assert user is not None - assert user.getUserName() == _user_name + self.failIf(user is None) + self.assertEqual(user.getUserName(), _user_name) def testNotAuthorize4(self): # Validate should deny us to call dm @@ -180,7 +180,7 @@ for p in _standard_permissions: pm.manage_permission(p, [], acquire=0) roles = self._call__roles__(pm) - assert self.uf.validate(request, auth, roles) is None + self.assertEqual(self.uf.validate(request, auth, roles), None) if __name__ == '__main__': Index: testDefaultWorkflow.py =================================================================== RCS file: /cvsroot/plone/CMFPlone/tests/testDefaultWorkflow.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- testDefaultWorkflow.py 23 Sep 2003 16:33:52 -0000 1.1 +++ testDefaultWorkflow.py 23 Sep 2003 18:27:58 -0000 1.2 @@ -24,7 +24,6 @@ self.portal.acl_users._doAddUser('reviewer', 'secret', ['Reviewer'], []) self.portal.acl_users._doAddUser('manager', 'secret', ['Manager'], []) - #self.catalog.addColumn('allowedRolesAndUsers') self.folder.invokeFactory('Document', id='doc') def testOwnerHidesVisibleDocument(self): Index: testQuickInstallerTool.py =================================================================== RCS file: /cvsroot/plone/CMFPlone/tests/testQuickInstallerTool.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- testQuickInstallerTool.py 21 Sep 2003 18:32:56 -0000 1.1 +++ testQuickInstallerTool.py 23 Sep 2003 18:27:58 -0000 1.2 @@ -19,16 +19,19 @@ def _installed(self): return [p['id'] for p in self.qi.listInstalledProducts()] + def _available(self): return [p['id'] for p in self.qi.listInstallableProducts()] def testInstallUninstallProduct(self): - '''CMFFormController should be uninstalled, we install it and it should not show up as installable''' + # CMFFormController should be uninstalled, we install it and + # it should not show up as installable self.qi.uninstallProducts(['CMFFormController',]) - assert 'CMFFormController' not in self._installed() - assert 'CMFFormController' in self._available() + self.failIf('CMFFormController' in self._installed()) + self.failUnless('CMFFormController' in self._available()) self.qi.installProduct('CMFFormController') - assert 'CMFFormController' not in self._available() + self.failIf('CMFFormController' in self._available()) + self.failUnless('CMFFormController' in self._installed()) if __name__ == '__main__': Index: testSkeletonZopeTest.py =================================================================== RCS file: /cvsroot/plone/CMFPlone/tests/testSkeletonZopeTest.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- testSkeletonZopeTest.py 19 Sep 2003 10:35:21 -0000 1.4 +++ testSkeletonZopeTest.py 23 Sep 2003 18:27:58 -0000 1.5 @@ -17,7 +17,7 @@ pass def testSomething(self): - '''Test something''' + # Test something self.failUnless(1==1) Index: testMembershipTool.py =================================================================== RCS file: /cvsroot/plone/CMFPlone/tests/testMembershipTool.py,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- testMembershipTool.py 22 Sep 2003 11:29:11 -0000 1.10 +++ testMembershipTool.py 23 Sep 2003 18:27:58 -0000 1.11 @@ -26,86 +26,86 @@ self.membership = self.portal.portal_membership def testGetPersonalFolder(self): - '''Should return the .personal folder''' + # Should return the .personal folder personal = getattr(self.folder, self.membership.personal_id, None) - assert personal is not None - assert self.membership.getPersonalFolder(_user_name) == personal + self.failIfEqual(personal, None) + self.assertEqual(self.membership.getPersonalFolder(_user_name), personal) def testGetPersonalFolderIfMissing(self): - '''Should return None as the .personal folder is missing''' + # Should return None as the .personal folder is missing self.folder._delObject(self.membership.personal_id) - assert self.membership.getPersonalFolder(_user_name) is None + self.assertEqual(self.membership.getPersonalFolder(_user_name), None) def testGetPersonalFolderIfNoHome(self): - '''Should return None as the user has no home folder''' + # Should return None as the user has no home folder members = self.membership.getMembersFolder() members._delObject(_user_name) - assert self.membership.getPersonalFolder(_user_name) is None + self.assertEqual(self.membership.getPersonalFolder(_user_name), None) def testGetPersonalPortrait(self): - '''Should return the default portrait''' - assert self.membership.getPersonalPortrait(_user_name).getId() == 'defaultUser.gif' + # Should return the default portrait + self.assertEqual(self.membership.getPersonalPortrait(_user_name).getId(), 'defaultUser.gif') def testChangeMemberPortrait(self): - '''Should change the portrait image''' + # Should change the portrait image self.membership.changeMemberPortrait(Portrait(), _user_name) - assert self.membership.getPersonalPortrait(_user_name).getId() == _user_name - assert self.membership.getPersonalPortrait(_user_name).meta_type == 'Image' + self.assertEqual(self.membership.getPersonalPortrait(_user_name).getId(), _user_name) + self.assertEqual(self.membership.getPersonalPortrait(_user_name).meta_type, 'Image') def testdeletePersonalPortrait(self): - '''Should change the portrait image''' + # Should change the portrait image self.membership.changeMemberPortrait(Portrait(), _user_name) self.membership.deletePersonalPortrait(_user_name) - assert self.membership.getPersonalPortrait(_user_name).getId() == 'defaultUser.gif' + self.assertEqual(self.membership.getPersonalPortrait(_user_name).getId(), 'defaultUser.gif') def testGetPersonalPortraitWithoutPassingId(self): - '''Should return the logged in users portrait if no id is given''' + # Should return the logged in users portrait if no id is given self.membership.changeMemberPortrait(Portrait(), _user_name) - assert self.membership.getPersonalPortrait().getId() == _user_name - assert self.membership.getPersonalPortrait().meta_type == 'Image' + self.assertEqual(self.membership.getPersonalPortrait().getId(), _user_name) + self.assertEqual(self.membership.getPersonalPortrait().meta_type, 'Image') def testListMembers(self): - '''Should return the members list''' + # Should return the members list members = self.membership.listMembers() - assert len(members) == 1 - assert members[0].getId() == _user_name + self.assertEqual(len(members), 1) + self.assertEqual(members[0].getId(), _user_name) def testListMembersSkipsGroups(self): - '''Should only return real members, not groups''' + # Should only return real members, not groups uf = self.portal.acl_users uf.changeOrCreateGroups(new_groups=['Foo', 'Bar']) - assert len(uf.getUserNames()) == 3 + self.assertEqual(len(uf.getUserNames()), 3) members = self.membership.listMembers() - assert len(members) == 1 - assert members[0].getId() == _user_name + self.assertEqual(len(members), 1) + self.assertEqual(members[0].getId(), _user_name) def testListMemberIds(self): - '''Should return the members ids list''' + # Should return the members ids list memberids = self.membership.listMemberIds() - assert len(memberids) == 1 - assert memberids[0] == _user_name + self.assertEqual(len(memberids), 1) + self.assertEqual(memberids[0], _user_name) def testListMemberIdsSkipsGroups(self): - '''Should only return real members, not groups''' + # Should only return real members, not groups uf = self.portal.acl_users uf.changeOrCreateGroups(new_groups=['Foo', 'Bar']) - assert len(uf.getUserNames()) == 3 + self.assertEqual(len(uf.getUserNames()), 3) memberids = self.membership.listMemberIds() - assert len(memberids) == 1 - assert memberids[0] == _user_name + self.assertEqual(len(memberids), 1) + self.assertEqual(memberids[0], _user_name) def testCurrentPassword(self): - '''Password checking should work''' - assert self.membership.testCurrentPassword('secret') - assert not self.membership.testCurrentPassword('geheim') + # Password checking should work + self.failUnless(self.membership.testCurrentPassword('secret')) + self.failIf(self.membership.testCurrentPassword('geheim')) def testSetPassword(self): - '''Password should be changed''' + # Password should be changed self.membership.setPassword('geheim') - assert self.membership.testCurrentPassword('geheim') + self.failUnless(self.membership.testCurrentPassword('geheim')) def testSetPasswordIfAnonymous(self): - '''Anonymous should not be able to change password''' + # Anonymous should not be able to change password self.logout() try: self.membership.setPassword('geheim') Index: testMemberDataTool.py =================================================================== RCS file: /cvsroot/plone/CMFPlone/tests/testMemberDataTool.py,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- testMemberDataTool.py 22 Sep 2003 11:29:11 -0000 1.6 +++ testMemberDataTool.py 23 Sep 2003 18:27:58 -0000 1.7 @@ -28,20 +28,20 @@ def testSetPortrait(self): self.memberdata._setPortrait(Image(id=_user_name, file=Portrait(), title=''), _user_name) - assert self.memberdata._getPortrait(_user_name).getId() == _user_name - assert self.memberdata._getPortrait(_user_name).meta_type == 'Image' + self.assertEqual(self.memberdata._getPortrait(_user_name).getId(), _user_name) + self.assertEqual(self.memberdata._getPortrait(_user_name).meta_type, 'Image') def testDeletePortrait(self): self.memberdata._setPortrait(Image(id=_user_name, file=Portrait(), title=''), _user_name) self.memberdata._deletePortrait(_user_name) - assert self.memberdata._getPortrait(_user_name) == None + self.assertEqual(self.memberdata._getPortrait(_user_name), None) def testPruneMemberDataContents(self): # Only test what is not already tested elswhere self.memberdata._setPortrait(Image(id=_user_name, file=Portrait(), title=''), _user_name) self.memberdata._setPortrait(Image(id=_user_name, file=Portrait(), title=''), 'dummy') self.memberdata.pruneMemberDataContents() - assert len(self.memberdata.portraits.objectIds()) == 1 + self.assertEqual(len(self.memberdata.portraits.objectIds()), 1) if __name__ == '__main__': Index: testFolderLocalRoleForm.py =================================================================== RCS file: /cvsroot/plone/CMFPlone/tests/testFolderLocalRoleForm.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- testFolderLocalRoleForm.py 21 Sep 2003 22:29:26 -0000 1.4 +++ testFolderLocalRoleForm.py 23 Sep 2003 18:27:58 -0000 1.5 @@ -23,21 +23,21 @@ # Should assing a local role self.folder.folder_localrole_edit('add', ['user2'], 'Foo') member = self.membership.getMemberById('user2') - assert member.getRolesInContext(self.folder) == ('Authenticated', 'Foo', 'Member') + self.assertEqual(member.getRolesInContext(self.folder), + ('Authenticated', 'Foo', 'Member')) def testFolderLocalRoleDelete(self): # Should delete a local role self.folder.folder_localrole_edit('add', ['user2'], 'Foo') member = self.membership.getMemberById('user2') - assert member.getRolesInContext(self.folder) == ('Authenticated', 'Foo', 'Member') + self.assertEqual(member.getRolesInContext(self.folder), + ('Authenticated', 'Foo', 'Member')) self.folder.folder_localrole_edit('delete', ['user2']) - assert member.getRolesInContext(self.folder) == ('Authenticated', 'Member') + self.assertEqual(member.getRolesInContext(self.folder), + ('Authenticated', 'Member')) def testFolderLocalRoleView(self): # Folder_localrole_form should render - # WOOSHA! This bombs because of - # Unauthorized: You are not allowed to access getGroups in this context - # TODO: Someone look into this please... self.folder.folder_localrole_form() Index: testContentTypeScripts.py =================================================================== RCS file: /cvsroot/plone/CMFPlone/tests/testContentTypeScripts.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- testContentTypeScripts.py 19 Sep 2003 20:35:23 -0000 1.2 +++ testContentTypeScripts.py 23 Sep 2003 18:27:58 -0000 1.3 @@ -45,69 +45,69 @@ self.folder.doc.talkback.discussion_reply('Foo', 'Blah', self.member) talkback = self.discussion.getDiscussionFor(self.folder.doc) reply = talkback.objectValues()[0] - assert reply.Title() == 'Foo' - assert reply.EditableBody() == 'Blah' + self.assertEqual(reply.Title(), 'Foo') + self.assertEqual(reply.EditableBody(), 'Blah') def testDocumentEdit(self): self.folder.invokeFactory('Document', id='doc') self.folder.doc.document_edit('plain', 'data') - assert self.folder.doc.EditableBody() == 'data' + self.assertEqual(self.folder.doc.EditableBody(), 'data') def testEventEdit(self): self.folder.invokeFactory('Event', id='event') self.folder.event.event_edit(title='Foo', start_date='2003-09-18', end_date='2003-09-19') - assert self.folder.event.Title() == 'Foo' - assert self.folder.event.start().ISO() == '2003-09-18 00:00:00' - assert self.folder.event.end().ISO() == '2003-09-19 00:00:00' + self.assertEqual(self.folder.event.Title(), 'Foo') + self.assertEqual(self.folder.event.start().ISO(), '2003-09-18 00:00:00') + self.assertEqual(self.folder.event.end().ISO(), '2003-09-19 00:00:00') def testFavoriteEdit(self): self.folder.invokeFactory('Favorite', id='favorite') self.folder.favorite.link_edit('bar/baz.html') - assert self.folder.favorite.getRemoteUrl() == \ - '%s/bar/baz.html' % self.portal.portal_url() + self.assertEqual(self.folder.favorite.getRemoteUrl(), + '%s/bar/baz.html' % self.portal.portal_url()) def testFileEdit(self): self.folder.invokeFactory('File', id='file') self.folder.file.file_edit(file=File()) - assert str(self.folder.file) == 'file_contents' + self.assertEqual(str(self.folder.file), 'file_contents') def testFolderEdit(self): self.folder.invokeFactory('Folder', id='folder') self.folder.folder.folder_edit('Foo', 'Bar') - assert self.folder.folder.Title() == 'Foo' - assert self.folder.folder.Description() == 'Bar' + self.assertEqual(self.folder.folder.Title(), 'Foo') + self.assertEqual(self.folder.folder.Description(), 'Bar') def testImageEdit(self): self.folder.invokeFactory('Image', id='image') self.folder.image.image_edit(file=File()) - assert str(self.folder.image.data) == 'file_contents' + self.assertEqual(str(self.folder.image.data), 'file_contents') def testLargePloneFolderEdit(self): LargePloneFolder.addLargePloneFolder(self.folder, 'lpf') self.folder.lpf.folder_edit('Foo', 'Bar') - assert self.folder.lpf.Title() == 'Foo' - assert self.folder.lpf.Description() == 'Bar' + self.assertEqual(self.folder.lpf.Title(), 'Foo') + self.assertEqual(self.folder.lpf.Description(), 'Bar') def testLinkEdit(self): self.folder.invokeFactory('Link', id='link') self.folder.link.link_edit('http://foo.com') - assert self.folder.link.getRemoteUrl() == 'http://foo.com' + self.assertEqual(self.folder.link.getRemoteUrl(), 'http://foo.com') def testNewsItemEdit(self): self.folder.invokeFactory('News Item', id='newsitem') self.folder.newsitem.newsitem_edit('data', 'plain') - assert self.folder.newsitem.EditableBody() == 'data' + self.assertEqual(self.folder.newsitem.EditableBody(), 'data') def testTopicEditTopic(self): self.folder.invokeFactory('Topic', id='topic') self.folder.topic.topic_editTopic(1, 'topic', title='Foo') - assert self.folder.topic.Title() == 'Foo' + self.assertEqual(self.folder.topic.Title(), 'Foo') - def testTopicEditCriteria(self): - self.folder.invokeFactory('Topic', id='topic') - # TODO: Analyze that funky data structure + #def testTopicEditCriteria(self): + # self.folder.invokeFactory('Topic', id='topic') + # # TODO: Analyze that funky data structure if __name__ == '__main__': Index: testActionsTool.py =================================================================== RCS file: /cvsroot/plone/CMFPlone/tests/testActionsTool.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- testActionsTool.py 19 Sep 2003 10:36:07 -0000 1.1 +++ testActionsTool.py 23 Sep 2003 18:27:58 -0000 1.2 @@ -16,7 +16,7 @@ self.actions = self.portal.portal_actions def testAddAction(self): - '''addAction should work even though PloneTestCase patches _cloneActions''' + # addAction should work even though PloneTestCase patches _cloneActions action_infos = self.actions.listActions() length = len(action_infos) self.actions.addAction(id='foo', @@ -27,11 +27,11 @@ category='foo_category', visible=1) action_infos = self.actions.listActions() - assert len(action_infos) == length + 1 - assert action_infos[-1].id == 'foo' - assert action_infos[-1].title == 'foo_name' - assert action_infos[-1].permissions == ('foo_permission',) - assert action_infos[-1].category == 'foo_category' + self.assertEqual(len(action_infos), length + 1) + self.assertEqual(action_infos[-1].id, 'foo') + self.assertEqual(action_infos[-1].title, 'foo_name') + self.assertEqual(action_infos[-1].permissions, ('foo_permission',)) + self.assertEqual(action_infos[-1].category, 'foo_category') if __name__ == '__main__': Index: testInterfaceTool.py =================================================================== RCS file: /cvsroot/plone/CMFPlone/tests/testInterfaceTool.py,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- testInterfaceTool.py 17 Sep 2003 12:33:56 -0000 1.3 +++ testInterfaceTool.py 23 Sep 2003 18:27:58 -0000 1.4 @@ -34,17 +34,17 @@ class TestInterfaceResolution(ZopeTestCase.ZopeTestCase): def testResolveDublinCore(self): - '''DublinCore should be resolved''' + # DublinCore should be resolved dotted_name = getDottedName(DublinCore) self.assertEqual(resolveInterface(dotted_name), DublinCore) def testResolveContentish(self): - '''Contentish should be resolved''' + # Contentish should be resolved dotted_name = getDottedName(Contentish) self.assertEqual(resolveInterface(dotted_name), Contentish) def testResolveNonInterface(self): - '''Should raise ValueError when called with non-Interface''' + # Should raise ValueError when called with non-Interface dotted_name = getDottedName(PortalContent) self.assertRaises(ValueError, resolveInterface, dotted_name) @@ -52,7 +52,7 @@ class TestInterfaceFinder(ZopeTestCase.ZopeTestCase): def testAvailableInterfaces(self): - '''Should find available interfaces''' + # Should find available interfaces from Products.CMFPlone.interfaces import InterfaceTool ifs = InterfaceFinder().findInterfaces(module=InterfaceTool) self.assertEqual(ifs, [getDottedName(InterfaceTool.IInterfaceTool)]) Index: testPortalCreation.py =================================================================== RCS file: /cvsroot/plone/CMFPlone/tests/testPortalCreation.py,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- testPortalCreation.py 19 Sep 2003 10:34:12 -0000 1.3 +++ testPortalCreation.py 23 Sep 2003 18:27:58 -0000 1.4 @@ -14,15 +14,15 @@ def afterSetUp(self): # The portal has already been set up, so there - # is little to do. + # is little to do. :-| pass def testPloneSkins(self): - '''Plone skins should have been set up''' - assert hasattr(self.folder, 'plone_powered.gif') + # Plone skins should have been set up + self.failUnless(hasattr(self.folder, 'plone_powered.gif')) def testDefaultView(self): - '''index_html should render (slow test)''' + # index_html should render self.portal.index_html() Index: testCatalogTool.py =================================================================== RCS file: /cvsroot/plone/CMFPlone/tests/testCatalogTool.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- testCatalogTool.py 15 Sep 2003 15:26:24 -0000 1.1 +++ testCatalogTool.py 23 Sep 2003 18:27:58 -0000 1.2 @@ -18,13 +18,14 @@ self.catalog = self.portal.portal_catalog def testPloneLexiconIsZCTextLexicon(self): - '''Lexicon should be a ZCTextIndex lexicon''' - assert hasattr(aq_base(self.catalog), 'plone_lexicon') - assert self.catalog.plone_lexicon.meta_type == 'ZCTextIndex Lexicon' + # Lexicon should be a ZCTextIndex lexicon + self.failUnless(hasattr(aq_base(self.catalog), 'plone_lexicon')) + self.assertEqual(self.catalog.plone_lexicon.meta_type, 'ZCTextIndex Lexicon') def testSearchableTextIsZCTextIndex(self): - '''SearchableText index should be a ZCTextIndex''' - assert self.catalog.Indexes['SearchableText'].__class__.__name__ == 'ZCTextIndex' + # SearchableText index should be a ZCTextIndex + self.assertEqual(self.catalog.Indexes['SearchableText'].__class__.__name__, + 'ZCTextIndex') if __name__ == '__main__': Index: testSkeletonPloneTest.py =================================================================== RCS file: /cvsroot/plone/CMFPlone/tests/testSkeletonPloneTest.py,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- testSkeletonPloneTest.py 19 Sep 2003 10:35:21 -0000 1.5 +++ testSkeletonPloneTest.py 23 Sep 2003 18:27:58 -0000 1.6 @@ -16,7 +16,7 @@ pass def testSomething(self): - '''Test something''' + # Test something self.failUnless(1==1) |