Changeset 1624


Ignore:
Timestamp:
04/04/07 17:37:01 (13 years ago)
Author:
szabolcs
Message:

fixed #1299 spent 3h

Location:
trunk
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/LeMillTool.py

    r1607 r1624  
    115115        body="\n\n%s\n\n" % str(body) 
    116116         
    117         lf1 = re.compile('\r\n') 
    118         lf2 = re.compile('\r') 
    119         body = lf1.sub('\n',body) 
    120         body = lf2.sub('\n',body) 
     117    body = body.replace('\r\n', '\n').replace('\r', '\n') 
    121118 
    122119        body = re.sub(r'\n\n\*\s', r'\n\n<ul><li>', body) 
     
    128125        body = re.sub(r'\n\#\s', r'</li><li>', body) 
    129126 
    130         body = re.sub('\n\n<ul>',"</p><ul>",body) 
    131         body = re.sub('</ul>\n\n',"</ul><p>",body) 
    132         body = re.sub('\n\n<ol>',"</p><ol>",body) 
    133         body = re.sub('</ol>\n\n',"</ol><p>",body) 
    134         body = re.sub('\n\n',"</p><p>",body) 
    135         body = re.sub('\n',"<br/>",body) 
     127 
     128        body = body.replace('\n\n<ul>',"</p><ul>") 
     129        body = body.replace('</ul>\n\n',"</ul><p>") 
     130        body = body.replace('\n\n<ol>',"</p><ol>") 
     131        body = body.replace('</ol>\n\n',"</ol><p>") 
     132        body = body.replace('\n\n',"</p><p>") 
     133        body = body.replace('\n',"<br />") 
    136134     
    137135        body = re.sub(r'\A</p>', '', body) 
     
    233231        self.portal_languages.setLanguageCookie(lang, REQUEST, None) 
    234232        if param: 
    235             param = re.sub('_and_', '&', param) 
     233            param = param.replace('_and_', '&') 
    236234            return REQUEST.RESPONSE.redirect(url+'?'+param) 
    237235        return REQUEST.RESPONSE.redirect(url) 
  • trunk/tests/testActivity.py

    r1622 r1624  
    4747        ob.processForm(values={'bodyText':bodyText}) 
    4848        page = self.publish(ob.absolute_url_path(), basic=auth).getBody() 
    49         self.failUnless(re.search(bodyText, page), """Activity's bodyText is missing from view page. Editing probably failed""") 
     49        self.failUnless(page.find(bodyText) != -1, """Activity's bodyText is missing from view page. Editing probably failed""") 
    5050         
    5151    def testAddActivityPortlet(self): 
     
    5353        path= self.portal.methods.absolute_url_path() 
    5454        result=self.publish(path,basic=auth).getBody() 
    55         self.failUnless(re.search('New method',result), 
     55        self.failUnless(result.find('New method') != -1, 
    5656            "Add activity portlet not found.") 
    5757 
     
    6363        path= ob.absolute_url_path() 
    6464        result=self.publish(path,basic=auth).getBody() 
    65         self.failUnless(re.search('Translate...',result), 
     65        self.failUnless(result.find('Translate...') != -1, 
    6666            "Translate-link not visible.") 
    6767 
  • trunk/tests/testCollections.py

    r1387 r1624  
    5252 
    5353        result=self.publish(self.portal.absolute_url_path()+'/community/test1/collections/', basic=auth).getBody() 
    54         self.failUnless(re.search('collections/balderdash',result), 'Link to collection was not found in collections page %s' % result) 
     54        self.failUnless(result.find('collections/balderdash') != -1, 'Link to collection was not found in collections page %s' % result) 
    5555 
    5656    def testCollectionView(self): 
     
    7272 
    7373        res = self.publish(obj.absolute_url_path(),basic=auth).getBody() 
    74         self.failUnless(re.search(TITLE,res) and re.search(MAT_TITLE,res),"Collection view page dysfunctional.") 
     74        self.failUnless(res.find(TITLE) != -1 and res.find(MAT_TITLE) != -1,"Collection view page dysfunctional.") 
    7575 
    7676    def testAnonymousMatchingCollections(self): 
     
    8989 
    9090        res = self.publish(mat.absolute_url_path()+'/view').getBody() 
    91         self.failUnless(re.search("View collections",res), "Collection link not shown.") 
    92         self.failUnless(re.search("(1)",res), "Collection count not shown correctly: %s" % res) 
     91        self.failUnless(res.find("View collections") != -1, "Collection link not shown.") 
     92        self.failUnless(res.find("(1)") != -1, "Collection count not shown correctly: %s" % res) 
    9393         
    9494 
  • trunk/tests/testCustomization.py

    r1326 r1624  
    4646        path=self.portal.content.absolute_url_path() 
    4747        result=self.publish(path).getBody() 
    48         self.failUnless(re.search('By language', result),"The link 'By language' is not there.") 
     48        self.failUnless(result.find('By language') != -1,"The link 'By language' is not there.") 
    4949        path=self.portal.content.language.absolute_url_path() 
    5050        result=self.publish(path).getStatus() 
     
    9797        MEMBER_FOLDER="Community".lower() 
    9898        MF=self.portal.portal_membership.getMembersFolder() 
    99         self.failUnless(re.search(MEMBER_FOLDER, MF.absolute_url_path()), "Members folder is not found in 'communities'")  
     99        self.failUnless(MF.absolute_url_path().find(MEMBER_FOLDER) != -1, "Members folder is not found in 'communities'")  
    100100                 
    101101    def testAddContentPortlet(self): 
     
    105105        path=self.portal.content.absolute_url_path() 
    106106        result=self.publish(path, basic=auth).getBody() 
    107         self.failUnless(re.search('/content/published', result),"The link to published in my content is missing.") 
     107        self.failUnless(result.find('/content/published') != -1,"The link to published in my content is missing.") 
    108108        path=self.portal.content.published.absolute_url_path() 
    109109        result=self.publish(path, basic=auth).getStatus() 
  • trunk/tests/testDeletePublish.py

    r1385 r1624  
    4646        auth="foobar:foobar" 
    4747        ID='hidingtest' 
    48         self.login('foobar')         
     48        self.login('foobar') 
    4949        ob=self.construct('MultimediaMaterial',ID, self.portal.content) 
    5050        path='/'.join((ob.absolute_url_path(),'view')) 
    5151        result = self.publish(path, basic=auth).getBody() 
    52         self.failUnless(re.search('hidingtest/delete', result), 'Link to delete material not found in page. %s' % result) 
    53         self.failIf(re.search('rescue', result), 'Link to restore material found when material is not deleted.') 
     52        self.failUnless(result.find('hidingtest/delete') != -1, 'Link to delete material not found in page. %s' % result) 
     53        self.failIf(result.find('rescue') != -1, 'Link to restore material found when material is not deleted.') 
    5454        ob.deleteResource(reason='Because I can') 
    5555        result = self.publish(path, basic=auth).getBody() 
    56         self.failUnless(re.search('rescue', result), 'Link to restore material not found in page.') 
    57         self.failIf(re.search('hidingtest/delete', result), 'Link to delete material found in page when material is already deleted.') 
    58         self.failUnless(re.search('\(DELETED\)', result), 'DELETED-status text not visible anywhere: %s' % result) 
     56        self.failUnless(result.find('rescue') != -1, 'Link to restore material not found in page.') 
     57        self.failIf(result.find('hidingtest/delete') != -1, 'Link to delete material found in page when material is already deleted.') 
     58        self.failUnless(result.find('(DELETED)') != -1, 'DELETED-status text not visible anywhere: %s' % result) 
    5959        result = self.publish(ob.absolute_url_path(), basic=auth).getBody() 
    60         self.failUnless(re.search('\(DELETED\)', result), 'DELETED-status text not visible in objects default view. Probably the whole content is visible there.') 
     60        self.failUnless(result.find('(DELETED)') != -1, 'DELETED-status text not visible in objects default view. Probably the whole content is visible there.') 
    6161        auth="foobar2:foobar2" 
    6262        self.login('foobar2') 
    6363        result = self.publish(path, basic=auth).getBody() 
    64         self.failIf(re.search('hidingtest/delete', result), 'Link to delete material visible for non-author.') 
    65         self.failIf(re.search('rescue', result), 'Link to restore material visible for non-author.')                                 
     64        self.failIf(result.find('hidingtest/delete') != -1, 'Link to delete material visible for non-author.') 
     65        self.failIf(result.find('rescue') != -1, 'Link to restore material visible for non-author.') 
    6666                 
    6767    def testModerator(self): 
    6868        auth="foobar:foobar" 
    6969        ID='hidingtest' 
    70         self.login('foobar')         
     70        self.login('foobar') 
    7171        ob=self.construct('MultimediaMaterial',ID, self.portal.content) 
    7272        path='/'.join((ob.absolute_url_path(),'view')) 
     
    7474        self.login('reviewer') 
    7575        result = self.publish(path, basic=auth).getBody() 
    76         self.failUnless(re.search('hidingtest/delete', result), 'Link to delete material not visible for moderator.') 
     76        self.failUnless(result.find('hidingtest/delete') != -1, 'Link to delete material not visible for moderator.') 
    7777        ob.deleteResource(reason="You're worthless") 
    78         result = self.publish(path, basic=auth).getBody()         
    79         self.failUnless(re.search('rescue', result), 'Link to restore material not visible for moderator.')                                 
     78        result = self.publish(path, basic=auth).getBody() 
     79        self.failUnless(result.find('rescue') != -1, 'Link to restore material not visible for moderator.') 
    8080 
    81     def testBrowsingVisibility(self):         
     81    def testBrowsingVisibility(self): 
    8282        auth="foobar:foobar" 
    8383        ID='hidingtest' 
    84         self.login('foobar')         
     84        self.login('foobar') 
    8585        ob=self.construct('MultimediaMaterial',ID, self.portal.content) 
    8686        ob.edit(title='hidingtest',tags='hidingtest') 
    8787        ob.deleteResource(reason="You're worthless") 
    88         path = self.portal.content.drafts.absolute_url_path()         
     88        path = self.portal.content.drafts.absolute_url_path() 
    8989        result = self.publish(path, basic=auth).getBody() 
    90         self.failIf(re.search('hidingtest', result), 'Deleted object visible in my drafts') 
     90        self.failIf(result.find('hidingtest') != -1, 'Deleted object visible in my drafts') 
    9191        path = self.portal.methods.published.absolute_url_path() 
    9292        result = self.publish(path, basic=auth).getBody() 
    93         self.failIf(re.search('Browse content where', result), "Deleted object counted in 'browse other types' -links") 
     93        self.failIf(result.find('Browse content where') != -1, "Deleted object counted in 'browse other types' -links") 
    9494        path = self.portal.content.absolute_url_path() 
    9595        result = self.publish(path+'/lemill_search_results?SearchableText=hidingtest', basic=auth).getBody() 
    96         self.failIf(re.search('matching your criteria', result), "Deleted object found in portal search results") 
     96        self.failIf(result.find('matching your criteria') != -1, "Deleted object found in portal search results") 
    9797         
    9898    
  • trunk/tests/testFolderBrowsing.py

    r1543 r1624  
    5555        path=self.portal.content.absolute_url_path() 
    5656        result=self.publish(path).getBody() 
    57         self.failUnless(re.search(TAGS_later, result),"The popular browse-by choice is not visible in folder index.") 
     57        self.failUnless(result.find(TAGS_later) != -1,"The popular browse-by choice is not visible in folder index.") 
    5858         
    5959        path=self.portal.methods.absolute_url_path() 
    6060        result=self.publish(path).getBody() 
    61         self.failIf(re.search(TAGS_later, result), "The popular browse-by choice is visible in wrong folder.") 
     61        self.failIf(result.find(TAGS_later) != -1, "The popular browse-by choice is visible in wrong folder.") 
    6262 
    6363    def testTagCloud(self): 
     
    7676        path=self.portal.content.tags.absolute_url_path() 
    7777        result=self.publish(path).getBody() 
    78         self.failUnless(re.search('size8', result),"Multiple instances of some tag do not create BIG words in taglist."+result) 
    79         self.failIf(re.search('getTags=Puerile', result),"Singular tag result has wrong kind of link.") 
     78        self.failUnless(result.find('size8') != -1,"Multiple instances of some tag do not create BIG words in taglist."+result) 
     79        self.failIf(result.find('getTags=Puerile') != -1,"Singular tag result has wrong kind of link.") 
    8080 
    8181    def testPortletLinksWorking(self): 
     
    9191        path=self.portal.content.drafts.absolute_url_path() 
    9292        result=self.publish(path, basic=auth).getBody() 
    93         self.failUnless(re.search('rafty object', result),"Created Drafty object isn't visible in my drafts -results."+result) 
    94         self.failIf(re.search('ublished object', result),"Created Published object is visible in my drafts -results."+result) 
     93        self.failUnless(result.find('rafty object') != -1,"Created Drafty object isn't visible in my drafts -results."+result) 
     94        self.failIf(result.find('ublished object') != -1,"Created Published object is visible in my drafts -results."+result) 
    9595         
    9696        path=self.portal.content.published.absolute_url_path() 
    9797        result=self.publish(path, basic=auth).getBody() 
    98         self.failUnless(re.search('ublished object', result),"Created Published object isn't visible in my published -results. %s " % result) 
    99         self.failIf(re.search('rafty object', result),"Created Drafty object is visible in my published -results.") 
     98        self.failUnless(result.find('ublished object') != -1,"Created Published object isn't visible in my published -results. %s " % result) 
     99        self.failIf(result.find('rafty object') != -1,"Created Drafty object is visible in my published -results.") 
    100100         
    101101    def testCommunityView(self): 
     
    124124        path=self.portal.community.absolute_url_path() 
    125125        result=self.publish(path).getBody() 
    126         self.failUnless(re.search('Finnish', result),"Popular languages of users are not visible in community-view") 
    127         self.failIf(re.search('Eustace', result),"Community page shows names for some reason.") 
     126        self.failUnless(result.find('Finnish') != -1,"Popular languages of users are not visible in community-view") 
     127        self.failIf(result.find('Eustace') != -1,"Community page shows names for some reason.") 
    128128         
    129129        path=self.portal.community.absolute_url_path()+"/language" 
    130130        result=self.publish(path).getBody() 
    131         self.failUnless(re.search('Finnish', result),"Popular languages of users are not visible in sort-by-language view") 
     131        self.failUnless(result.find('Finnish') != -1,"Popular languages of users are not visible in sort-by-language view") 
    132132 
    133133        # This test is no longer relevant -- query would be 'getSortable_nicename=' and these won't happen. 
     
    137137         
    138138        path=self.portal.community.absolute_url_path() 
    139         result=self.publish(path).getBody()         
    140         self.failUnless(re.search('orbital', result),"Popular tag not visible in community front page.") 
     139        result=self.publish(path).getBody() 
     140        self.failUnless(result.find('orbital') != -1,"Popular tag not visible in community front page.") 
    141141 
    142142        path=self.portal.community.absolute_url_path()+"/interests?getInterests=orbital" 
    143143        result=self.publish(path).getBody() 
    144         self.failIf(re.search('getTags=o">', result),"Member tags are split into characters!") 
     144        self.failIf(result.find('getTags=o">') != -1,"Member tags are split into characters!") 
    145145        #self.failUnless(re.search('Eustace', result),"Tried to find user with a certain tag; no user found."+result+repr(user1)) 
    146         self.failIf(re.search('Zakalwe', result),"Tried to find user with a certain tag; result contains users with no such tags.") 
     146        self.failIf(result.find('Zakalwe') != -1,"Tried to find user with a certain tag; result contains users with no such tags.") 
    147147         
    148148 
  • trunk/tests/testGroups.py

    r1622 r1624  
    4444        workspace1 = self.getGroupBlog('testgroup1') 
    4545        result=self.publish(workspace1.absolute_url_path()+'/view', basic=auth).getBody() 
    46         self.failUnless(re.search('portlet-groupblog-actions', result), "Portlet not shown") 
     46        self.failUnless(result.find('portlet-groupblog-actions') != -1, "Portlet not shown") 
    4747 
    4848    def testGroupEdit(self): 
     
    5858        # why that^^ works but that^ doesn't?  
    5959        for prop in ['title','description','tags']: 
    60             self.failUnless(re.search(prop, result.getBody()), "edit form broken, missing property:"+prop+result.getBody()) 
     60            self.failUnless(result.getBody().find(prop) != -1, "edit form broken, missing property:"+prop+result.getBody()) 
    6161 
    6262    # joining, leaving and such are not tested, because they're just calls to GroupUserFolder's methods in form handler scripts. 
     
    7070        self.workspace1.setProperties(title=self.TOKENS1) # This should affect the group too. 
    7171        result=self.publish(self.portal.absolute_url_path()+'/community/groups', basic=auth) 
    72         self.failUnless(re.search(self.TOKENS1, result.getBody()), "can't find created group when browsing group names"+result.getBody()) 
     72        self.failUnless(result.getBody().find(self.TOKENS1) != -1, "can't find created group when browsing group names"+result.getBody()) 
    7373 
    7474    def testInviteGroups(self): 
     
    8787        # 1) there shouldn't be invite -link visible in your own profile page 
    8888        result=self.publish(self.portal.community.inviter.absolute_url_path(), basic=iauth) 
    89         self.failIf(re.search('Invite to group', result.getBody()), "Invite to group - link visible for your own page"+result.getBody()) 
     89        self.failIf(result.getBody().find('Invite to group') != -1, "Invite to group - link visible for your own page"+result.getBody()) 
    9090        # 2) there should be invite link in other people's profiles 
    9191        result=self.publish(self.portal.community.invited.absolute_url_path(), basic=iauth) 
    92         self.failUnless(re.search('Invite to group', result.getBody()), "Invite to group - link not visible in other people's pages"+result.getBody()) 
     92        self.failUnless(result.getBody().find('Invite to group') != -1, "Invite to group - link not visible in other people's pages"+result.getBody()) 
    9393        # 3) invite form should show your groups 
    9494        result=self.publish(self.portal.community.invited.absolute_url_path()+'/group_invite', basic=iauth) 
    95         self.failUnless(re.search('testgroup1', result.getBody()), "group1 not visible in group invite form"+result.getBody()) 
    96         self.failUnless(re.search('testgroup2', result.getBody()), "group2 not visible in group invite form"+result.getBody()) 
    97         self.failIf(re.search('already a member', result.getBody()), "marked as member in group invite form when shouldn't be"+result.getBody()) 
     95        self.failUnless(result.getBody().find('testgroup1') != -1, "group1 not visible in group invite form"+result.getBody()) 
     96        self.failUnless(result.getBody().find('testgroup2') != -1, "group2 not visible in group invite form"+result.getBody()) 
     97        self.failIf(result.getBody().find('already a member') != -1, "marked as member in group invite form when shouldn't be"+result.getBody()) 
    9898        # 4) if our invitee is already a member, there should be a notion of that 
    9999        self.login('invited') 
    100100        self.workspace1.join_group() 
    101101        result=self.publish(self.portal.community.invited.absolute_url_path()+'/group_invite', basic=iauth) # this is still ran as portal_owner 
    102         self.failUnless(re.search('already a member', result.getBody()), "member is already in group, but it doesn't get noticed"+result.getBody())               
     102        self.failUnless(result.getBody().find('already a member') != -1, "member is already in group, but it doesn't get noticed"+result.getBody())               
    103103         
    104104        
     
    141141        TITLE=cases[0][1] 
    142142        BODY=cases[0][2] 
    143         self.failIf(re.search(TITLE, result.getBody()), "Found post titled %s from community front page when member is not member of group." % TITLE) 
    144         self.failIf(re.search(BODY, result.getBody()), "Found post body %s from community front page when member is not member of group." % BODY) 
     143        self.failIf(result.getBody().find(TITLE) != -1, "Found post titled %s from community front page when member is not member of group." % TITLE) 
     144        self.failIf(result.getBody().find(BODY) != -1, "Found post body %s from community front page when member is not member of group." % BODY) 
    145145 
    146146        self.workspace.join_group() 
     
    148148 
    149149        for (ID, TITLE, BODY) in cases: 
    150             self.failUnless(re.search(TITLE, result.getBody()), "can't find post %s from community front page: %s" % (TITLE,result.getBody())) 
    151             self.failUnless(re.search(BODY, result.getBody()), "can't find post body %s from community front page: %s" % (BODY, result.getBody())) 
     150            self.failUnless(result.getBody().find(TITLE) != -1, "can't find post %s from community front page: %s" % (TITLE,result.getBody())) 
     151            self.failUnless(result.getBody().find(BODY) != -1, "can't find post body %s from community front page: %s" % (BODY, result.getBody())) 
    152152 
    153153 
     
    172172        bauth = ':'.join(('foobar', 'foobar')) 
    173173        result = self.publish(ob.absolute_url_path()+'/edit', basic=bauth).getBody() 
    174         self.failUnless(re.search('Unauthorized', result), 'Not yet joined a group but can edit material already... somethings wrong') 
     174        self.failUnless(result.find('Unauthorized') != -1, 'Not yet joined a group but can edit material already... somethings wrong') 
    175175        joining = self.publish(self.portal.absolute_url_path()+'/community/testgroup/join_group', basic='foobar:foobar').getBody() 
    176176        result = self.publish(ob.absolute_url_path()+'/edit', basic=bauth).getBody() 
    177         self.failIf(re.search('Unauthorized', result), 'Joined a group but cannot edit material.') 
     177        self.failIf(result.find('Unauthorized') != -1, 'Joined a group but cannot edit material.') 
    178178         
    179179    def testBanning(self): 
     
    188188        bauth = ':'.join(('foobar', 'foobar')) 
    189189        joining = self.publish(self.portal.absolute_url_path()+'/community/testgroup/join_group', basic=bauth).getBody() 
    190         self.failUnless(re.search('been%20banned', joining), 'User should be banned and unable to join. %s' % joining) 
     190        self.failUnless(joining.find('been%20banned') != -1, 'User should be banned and unable to join. %s' % joining) 
    191191        self.loginAsPortalOwner() 
    192192        self.workspace.setBanned('') 
    193193        self.login('foobar') 
    194194        joining = self.publish(self.portal.absolute_url_path()+'/community/testgroup/join_group', basic=bauth).getBody() 
    195         self.failIf(re.search('been%20banned', joining), 'User should be able to join. %s' % joining) 
     195        self.failIf(joining.find('been%20banned') != -1, 'User should be able to join. %s' % joining) 
    196196     
    197197    def testModerating(self): 
     
    200200        self.group = self.newGroup('testgroup') 
    201201        self.workspace = self.getGroupBlog('testgroup') 
    202         self.workspace.join_group()        
     202        self.workspace.join_group() 
    203203        self.addUser('foobar','foobar', ('Member',)) 
    204204        self.login('foobar') 
     
    211211            ob = self.construct('BlogPost',ID,self.portal.community.testgroup) 
    212212            ob.processForm(values={'title':TITLE,'bodyText':BODY, 'category':CATEGORY}) 
    213             ob.at_post_edit_script()            
     213            ob.at_post_edit_script() 
    214214 
    215215        self.login('foobar') 
    216216        self.failUnless('Reviewer' in self.workspace.getRoles(), 'Member did not get moderator rights %s ' % self.workspace.getRoles()) 
    217217        result= self.publish(self.portal.absolute_url_path()+'/community/testgroup/firstpost', basic=bauth).getBody() 
    218         self.failUnless(re.search('firstpost/delete_post', result), "Moderator can't see delete post link %s" % result) 
     218        self.failUnless(result.find('firstpost/delete_post') != -1, "Moderator can't see delete post link %s" % result) 
    219219        try: 
    220220            self.workspace.firstpost.delete_post() 
    221221        except: 
    222             self.fail("Moderator couldn't delete post.")               
     222            self.fail("Moderator couldn't delete post.") 
    223223     
    224224 
     
    232232        self.workspace.join_group() 
    233233        result=self.publish(self.portal.absolute_url_path()+'/community/testgroup') 
    234         self.failUnless(re.search('community/foobar', result.getBody()), "When viewing group page anonymously, members are not visible") 
    235         self.failIf(re.search('logout', result.getBody()), "Oops, foobar is still logged in.") 
     234        self.failUnless(result.getBody().find('community/foobar') != -1, "When viewing group page anonymously, members are not visible") 
     235        self.failIf(result.getBody().find('logout') != -1, "Oops, foobar is still logged in.") 
    236236 
    237237 
  • trunk/tests/testMaterial.py

    r1622 r1624  
    9494        material = self.construct('MultimediaMaterial', 'TestMaterial' ,self.portal.content) 
    9595        page = self.publish(material.absolute_url_path()+'/view', basic=auth).getBody() 
    96         self.failUnless(re.search('portlet-material-actions', page), 'Cannot find portlet-material-actions from material\'s view page') 
     96        self.failUnless(page.find('portlet-material-actions') != -1, 'Cannot find portlet-material-actions from material\'s view page') 
    9797 
    9898    def testEditing(self): 
     
    110110            result = self.publish(ob.absolute_url_path()+'/base_metadata', basic=auth).getBody() 
    111111            for f in ['allowDiscussion', 'subject', 'effectiveDate', 'expirationDate', 'coverImage']: 
    112                 self.failIf(re.search('label for="'+f+'"', result), "Field \"%s\" found from metadata editing page" % f) 
     112                self.failIf(result.find('label for="%s"' % f) != -1, "Field \"%s\" found from metadata editing page" % f) 
    113113 
    114114    def testMetadataVisibilityOfAll(self): 
     
    122122            result = self.publish('/'.join((ob.absolute_url_path(),metadata_edit_url)), basic=auth).getBody() 
    123123            for f in ('Philosophy','Foreign languages','Social sciences','Art'): 
    124                 self.failUnless(re.search(f,result), "Subject area %s not shown on metadata page" % f) 
     124                self.failUnless(result.find(f) != -1, "Subject area %s not shown on metadata page" % f) 
    125125 
    126126    def testViewWithoutBodyTextLabel(self): 
     
    130130            ob.edit(bodyText='This is a test body') 
    131131            res = self.publish(ob.absolute_url_path()).getBody() 
    132             self.failIf(re.search('Body text',res),"Body text label shown for material %s" % t) 
     132            self.failIf(res.find('Body text') != -1,"Body text label shown for material %s" % t) 
    133133 
    134134    def testEditPageTitle(self): 
  • trunk/tests/testMemberPrefLink.py

    r440 r1624  
    4444        path=self.portal.content.absolute_url_path()  
    4545        result=self.publish(path, basic=auth).getBody() 
    46         self.failUnless(re.search("community/foobarlogin", result)) 
     46        self.failUnless(result.find("community/foobarlogin") != -1) 
    4747 
    4848def test_suite(): 
  • trunk/tests/testPiece.py

    r415 r1624  
    6161        path = ob.absolute_url_path()+'/view' 
    6262        result = self.publish(path).getBody() 
    63         self.failUnless(re.search("Explanation of Level Double-A Conformance", result), "WCAG log not found? It may be possible that user doesn't have access to view object.") 
     63        self.failUnless(result.find("Explanation of Level Double-A Conformance") != -1, "WCAG log not found? It may be possible that user doesn't have access to view object.") 
    6464 
    6565def test_suite(): 
  • trunk/tests/testPilotMaterial.py

    r1622 r1624  
    5252        material = self.construct('PILOTMaterial', 'TestMaterial' ,self.portal.content) 
    5353        page = self.publish(material.absolute_url_path()+'/view', basic=auth).getBody() 
    54         self.failUnless(re.search('portlet-material-actions', page), 'Cannot find portlet-material-actions from material\'s view page') 
     54        self.failUnless(page.find('portlet-material-actions') != -1, 'Cannot find portlet-material-actions from material\'s view page') 
    5555 
    5656    def testEditing(self): 
  • trunk/tests/testPresentation.py

    r1622 r1624  
    5252        material = self.construct('PresentationMaterial', 'TestMaterial' ,self.portal.content) 
    5353        page = self.publish(material.absolute_url_path()+'/view', basic=auth).getBody() 
    54         self.failUnless(re.search('portlet-material-actions', page), 'Cannot find portlet-material-actions from material\'s view page') 
     54        self.failUnless(page.find('portlet-material-actions') != -1, 'Cannot find portlet-material-actions from material\'s view page') 
    5555 
    5656    def testEditing(self): 
     
    6666        result = self.publish(ob.absolute_url_path()+'/base_metadata', basic=auth).getBody() 
    6767        for f in ['allowDiscussion', 'subject', 'effectiveDate', 'expirationDate', 'coverImage']: 
    68             self.failIf(re.search('label for="'+f+'"', result), "Field \"%s\" found from metadata editing page" % f) 
     68            self.failIf(result.find('label for="%s"' % f) != -1, "Field \"%s\" found from metadata editing page" % f) 
    6969 
    7070    def testAuthorInformation(self): 
  • trunk/tests/testRSS.py

    r1524 r1624  
    8282        for testq in testset: 
    8383            path=testq['path'].absolute_url_path()+'/RSS' 
    84             result=self.publish(path).getOutput()             
    85             self.failUnless(re.search('rdf:resource', result), "Loading RSS-page seems to have failed, rdf:resources missing: %s" % path) 
    86             self.failUnless(re.search('rdf:about', result), "Loading RSS-page seems to have failed, rdf:about missing") 
     84            result=self.publish(path).getOutput() 
     85            self.failUnless(result.find('rdf:resource') != -1, "Loading RSS-page seems to have failed, rdf:resources missing: %s" % path) 
     86            self.failUnless(result.find('rdf:about') != -1, "Loading RSS-page seems to have failed, rdf:about missing") 
    8787            for f in testq['find']: 
    88                 self.failUnless(re.search(f, result), "Couldn't find item %s in rss-feed from path %s" % (f, path)) 
     88                self.failUnless(result.find(f) != -1, "Couldn't find item %s in rss-feed from path %s" % (f, path)) 
    8989            for f in testq['dontfind']: 
    90                 self.failIf(re.search(f, result), "Found item %s in rss-feed from path %s, it shouldn't be there!" % (f, path)) 
     90                self.failIf(result.find(f) != -1, "Found item %s in rss-feed from path %s, it shouldn't be there!" % (f, path)) 
    9191 
    9292    def testWhatsNew(self): 
    9393        path=self.portal.content.recent.absolute_url_path()+'/RSS' 
    9494        result=self.publish(path).getOutput() 
    95         self.failUnless(re.search('rdf:resource', result), "Loading RSS-page seems to have failed, rdf:resources missing: %s" % path) 
    96         self.failUnless(re.search('LR', result), "Learning resource-sign [LR] not found in what's new results. ") 
    97         self.failIf(re.search('MP', result), "Media Piece sign [MP] found in what's new results, but there aren't pieces here. ") 
     95        self.failUnless(result.find('rdf:resource') != -1, "Loading RSS-page seems to have failed, rdf:resources missing: %s" % path) 
     96        self.failUnless(result.find('LR') != -1, "Learning resource-sign [LR] not found in what's new results. ") 
     97        self.failIf(result.find('MP') != -1, "Media Piece sign [MP] found in what's new results, but there aren't pieces here. ") 
    9898         
    9999    def testSearchRSS(self): 
     
    107107            path=basepath+testq['query'] 
    108108            result=self.publish(path).getOutput() 
    109             self.failUnless(re.search('rdf:resource', result), "Loading RSS-page seems to have failed, rdf:resources missing: %s" % path) 
    110             self.failUnless(re.search('rdf:about', result), "Loading RSS-page seems to have failed, rdf:about missing") 
     109            self.failUnless(result.find('rdf:resource') != -1, "Loading RSS-page seems to have failed, rdf:resources missing: %s" % path) 
     110            self.failUnless(result.find('rdf:about') != -1, "Loading RSS-page seems to have failed, rdf:about missing") 
    111111            for f in testq['find']: 
    112                 self.failUnless(re.search(f, result), "Couldn't find item %s in rss-feed from path %s, %s" % (f, path,result)) 
     112                self.failUnless(result.find(f) != -1, "Couldn't find item %s in rss-feed from path %s, %s" % (f, path,result)) 
    113113            for f in testq['dontfind']: 
    114                 self.failIf(re.search(f, result), "Found item %s in rss-feed from path %s, it shouldn't be there!" % (f, path)) 
     114                self.failIf(result.find(f) != -1, "Found item %s in rss-feed from path %s, it shouldn't be there!" % (f, path)) 
    115115 
    116116         
     
    129129            path=testq['path'].absolute_url_path()+'/RSS'+testq['query'] 
    130130            result=self.publish(path).getOutput() 
    131             self.failUnless(re.search('rdf:resource', result), "Loading RSS-page seems to have failed, rdf:resources missing: %s" % path) 
    132             self.failUnless(re.search('rdf:about', result), "Loading RSS-page seems to have failed, rdf:about missing") 
     131            self.failUnless(result.find('rdf:resource') != -1, "Loading RSS-page seems to have failed, rdf:resources missing: %s" % path) 
     132            self.failUnless(result.find('rdf:about') != -1, "Loading RSS-page seems to have failed, rdf:about missing") 
    133133            for f in testq['find']: 
    134                 self.failUnless(re.search(f, result), "Couldn't find item %s in rss-feed from path %s, %s" % (f, path, result)) 
     134                self.failUnless(result.find(f) != -1, "Couldn't find item %s in rss-feed from path %s, %s" % (f, path, result)) 
    135135            for f in testq['dontfind']: 
    136                 self.failIf(re.search(f, result), "Found item %s in rss-feed from path %s, it shouldn't be there!" % (f, path)) 
     136                self.failIf(result.find(f) != -1, "Found item %s in rss-feed from path %s, it shouldn't be there!" % (f, path)) 
    137137         
    138138 
  • trunk/tests/testReference.py

    r1286 r1624  
    4848        material = self.construct('LeMillReference', 'TestMaterialReference' ,self.portal.content) 
    4949        page = self.publish(material.absolute_url_path()+'/view', basic=auth).getBody() 
    50         self.failUnless(re.search('portlet-material-actions', page), 'Cannot find portlet-material-actions from material\'s view page %s' % page) 
    51         self.failIf(re.search('Change to draft', page), "References shouldn't be retracted") 
    52         self.failIf(re.search('Translate', page), "References shouldn't be translated") 
    53         self.failIf(re.search('Student view', page), "References shouldn't have fullscreen view") 
    54         self.failUnless(re.search('cover image', page), 'Cannot find link to edit cover image in reference') 
    55         self.failUnless(re.search('History', page), 'Cannot find link to history in reference') 
    56         self.failUnless(re.search('Delete', page), 'Cannot find link to delete reference') 
    57         self.failUnless(re.search('Edit...', page), 'Cannot find link to edit reference') 
     50        self.failUnless(page.find('portlet-material-actions') != -1, 'Cannot find portlet-material-actions from material\'s view page %s' % page) 
     51        self.failIf(page.find('Change to draft') != -1, "References shouldn't be retracted") 
     52        self.failIf(page.find('Translate') != -1, "References shouldn't be translated") 
     53        self.failIf(page.find('Student view') != -1, "References shouldn't have fullscreen view") 
     54        self.failUnless(page.find('cover image') != -1, 'Cannot find link to edit cover image in reference') 
     55        self.failUnless(page.find('History') != -1, 'Cannot find link to history in reference') 
     56        self.failUnless(page.find('Delete') != -1, 'Cannot find link to delete reference') 
     57        self.failUnless(page.find('Edit...') != -1, 'Cannot find link to edit reference') 
    5858 
    5959 
  • trunk/tests/testStory.py

    r1543 r1624  
    8383        ob.edit(description=description) 
    8484        page = self.publish(ob.absolute_url_path()).getBody() 
    85         self.failUnless(re.search(description, page), 'Cannot find body from story\'s view page') 
     85        self.failUnless(page.find(description) != -1, 'Cannot find body from story\'s view page') 
    8686        page = self.publish(ob.absolute_url_path()+'/edit', basic=auth).getBody() 
    87         self.failUnless(re.search(description, page), 'Cannot find body from story\'s edit page') 
     87        self.failUnless(page.find(description) != -1, 'Cannot find body from story\'s edit page') 
    8888 
    8989 
  • trunk/tests/testTool.py

    r1622 r1624  
    4747        path= self.portal.tools.absolute_url_path() 
    4848        result=self.publish(path,basic=auth).getBody() 
    49         self.failUnless(re.search('New tool',result), 
     49        self.failUnless(result.find('New tool') != -1, 
    5050            "Add tool portlet not found. %s" % result) 
    5151 
     
    5555        ob.edit(bodyText=bodyText) 
    5656        page = self.publish(ob.absolute_url_path()+'/view').getBody() 
    57         self.failUnless(re.search(bodyText, page), """Tool's bodyText is missing from view page. 
     57        self.failUnless(page.find(bodyText) != -1, """Tool's bodyText is missing from view page. 
    5858                Editing propably failed""") 
    5959 
     
    6464        path= ob.absolute_url_path() 
    6565        result=self.publish(path,basic=auth).getBody() 
    66         self.failUnless(re.search('Translate...',result), 
     66        self.failUnless(result.find('Translate...') != -1, 
    6767            "Translate-link not visible.") 
    6868 
  • trunk/tests/testToolBoxSearchTool.py

    r1303 r1624  
    3838    def testSearchResultView(self): 
    3939        result=self.publish(self.portal.absolute_url_path()+'/lemill_search_results?SearchableText=tester23') 
    40     self.failIf(re.search('ProtocolError',result.getBody()), 
    41             "Search connection to remote LeMill failed, server possibly down or incompatible.") 
    42         self.failUnless(re.search('search_rss',result.getBody()), 
     40        self.failIf(result.getBody().find('ProtocolError') != -1, 
     41            "Search connection to remote LeMill failed, server possibly down or incompatible.") 
     42        self.failUnless(result.getBody().find('search_rss') != -1, 
    4343                "%s\n\nResults page has no RSS result: %s" % (result.getBody()[:-1], result.getPath())) 
    44         self.failUnless(re.search('Search results',result.getBody()), 
     44        self.failUnless(result.getBody().find('Search results') != -1, 
    4545                "%s\n\nResults page not working: %s" % (result.getBody(), result.getPath())) 
    4646 
     
    6161        self.failUnless(url in tool.get_urls_of_remote_lemilles(), 'adding '+url+' failed.') 
    6262        # get dictionary 
    63         tbs = tool.get_remote_lemilles()             
     63        tbs = tool.get_remote_lemilles() 
    6464        id = max(tbs.keys()) # id. the largest is the last? 
    6565        tool.delete_remote_lemill(id) 
     
    8080        path=self.portal.absolute_url_path()+'/lemill_search_results?SearchableText=academic' 
    8181        result=self.publish(path).getBody() 
    82         self.failUnless(re.search('Testaa',result), 
     82        self.failUnless(result.find('Testaa') != -1, 
    8383                "Results page not working, 'Testaa' object is not there: %s" % result) 
    8484 
  • trunk/tests/testUsers.py

    r1222 r1624  
    4848        for prop in MEMBER_PROPERTIES: 
    4949            if not prop[2]=="hidden": 
    50                 self.failUnless(re.search(prop[0], body), "personalize_form broken, property %s not found" % prop[0] + body) 
     50                self.failUnless(body.find(prop[0]) != -1, "personalize_form broken, property %s not found" % prop[0] + body) 
    5151       
    5252 
  • trunk/tests/testVersioning.py

    r1116 r1624  
    4747 
    4848        res = self.publish(self.material.absolute_url_path()+'/base_view', basic=auth).getBody() 
    49         self.failUnless(re.search('Duplicate and edit', res), "button 'Duplicate and edit' not found") 
     49        self.failUnless(res.find('Duplicate and edit') != -1, "button 'Duplicate and edit' not found") 
    5050         
    5151        res = self.publishFollowRedirect(self.material.absolute_url_path()+'/start_new_version?objId=content/material_tester', basic=auth).getBody() 
  • trunk/tests/testWorkflow.py

    r1385 r1624  
    4747        url = self.act.absolute_url_path()+'/edit' 
    4848        result = self.publish(url,basic='foobar:foobar').getBody() 
    49         self.failUnless(re.search('bodyText',result), 
     49        self.failUnless(result.find('bodyText') != -1, 
    5050                        "Editing of activities not allowed for members") 
    5151 
     
    5454        self.workflow.doActionFor(self.doc, 'publish') 
    5555        result = self.publish(self.doc.absolute_url_path()).getBody() 
    56         self.failIf(re.search('draft', result),result) 
     56        self.failIf(result.find('draft') != -1,result) 
    5757 
    5858 
Note: See TracChangeset for help on using the changeset viewer.