source: trunk/tests/testWYSIWYM.py @ 41

Revision 41, 1.6 KB checked in by laszlo, 14 years ago (diff)

Partial implementation of the WYSIWYM Editor. references #89 spent 4h remaining 4h

Line 
1#
2# Test case for WYSIWYM content
3#
4
5import os, sys, re
6if __name__ == '__main__':
7    execfile(os.path.join(sys.path[0], 'framework.py'))
8
9from Testing import ZopeTestCase
10from ToolboxTestCase import ToolboxTestCase
11from Products.CMFCore.utils import getToolByName
12from Products.PloneTestCase.setup import portal_owner, default_password
13
14types = ('Module',)
15auth=':'.join((portal_owner, default_password))
16
17class TestWYSIWYM(ToolboxTestCase):
18
19    def addUser(self,id,passwd,roles=(),domains=(),groups=()):
20        rtool = getToolByName(self.portal,'portal_registration')
21        if rtool.isMemberIdAllowed(id):
22            member = rtool.addMember(id,passwd,roles,domains)
23            self.portal.acl_users.userSetGroups(id,groups)
24
25    def afterSetUp(self):
26        self.ID='TestModule'
27        self.ob=self.construct('Module',self.ID,self.folder)
28        self.addUser('foobar','foobar')
29
30    def construct(self, portal_type, id, folder):
31        folder.invokeFactory(type_name=portal_type,id=id)
32        self.failUnless(id in folder.objectIds())
33        return getattr(folder, id)
34
35    def testEditing(self):
36        path='/'.join((self.folder.absolute_url_path(),self.ID, 'base_edit'))
37        result=self.publish(path,basic=auth).getBody()
38        #raise "FOO",str(result)
39        self.failUnless(re.search('WYSIWYM Editor',result),"The comment 'WYSIWYM' is not found")
40
41def test_suite():
42    from unittest import TestSuite, makeSuite
43    suite = TestSuite()
44    suite.addTest(makeSuite(TestWYSIWYM))
45    return suite
46
47if __name__ == '__main__':
48    framework()
Note: See TracBrowser for help on using the repository browser.