Changeset 2048


Ignore:
Timestamp:
09/24/07 17:55:06 (13 years ago)
Author:
jukka
Message:

Fixed tests.

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/ExerciseMaterial.py

    r2039 r2048  
    8484        field=self.getField('bodyText') 
    8585        values = field.get(self) 
    86         dump= '\n'.join([x[0] for x in values if not x[1]!='piece']) 
     86        dump= '\n'.join([x[0] for x in values if x[1] not in ['piece', 'multiple_choices']]) 
    8787        return dump 
    8888 
  • trunk/FieldsWidgets.py

    r2047 r2048  
    505505                    if piece not in ('', 'thisisamediapiecethisisamediapie'): 
    506506                        res=uc({'UID':piece}) 
    507                         pTags = list(res[0].getObject().getTags()) 
    508                         tagsChanged = False 
    509                         for tag in tags: 
    510                             if tag not in pTags: 
    511                                 tagsChanged = True 
    512                                 pTags.append(tag) 
    513                         for tag in oldTags: 
    514                             if tag in pTags and tag not in tags: 
    515                                 tagsChanged = True 
    516                                 pTags.remove(tag) 
    517                         if(tagsChanged): 
    518                             res[0].getObject().setTags(tuple(pTags)) 
     507                        if res: 
     508                            pTags = list(res[0].getObject().getTags()) 
     509                            tagsChanged = False 
     510                            for tag in tags: 
     511                                if tag not in pTags: 
     512                                    tagsChanged = True 
     513                                    pTags.append(tag) 
     514                            for tag in oldTags: 
     515                                if tag in pTags and tag not in tags: 
     516                                    tagsChanged = True 
     517                                    pTags.remove(tag) 
     518                            if(tagsChanged): 
     519                                res[0].getObject().setTags(tuple(pTags)) 
    519520            value = ','.join(tags) 
    520521    if isinstance(value,str): 
  • trunk/LargeSectionFolder.py

    r2003 r2048  
    639639            val = from_accessor() 
    640640            if k=='bodyText' and from_obj_type in ['ExerciseMaterial', 'MultimediaMaterial']: 
    641                 val=from_obj.getOnlyText() 
     641                val=from_obj.getOnlyText()                 
    642642            copied_val = None 
     643            if k=='bodyText' and to_obj_type=='ExerciseMaterial': 
     644                val=(val,'guidelines') 
     645                print val 
    643646            try: 
    644647                copied_val = copy.copy(val) 
  • trunk/LeMillTool.py

    r2037 r2048  
    5555    (?P<html_open><(?P<html_tag>[a-z!][^\s>]*).*?>) # opening html tags, those that begin with '<x', where x is a letter  
    5656    |(?P<html_close></.*?>) # closing html tags, those that begin with '</' 
    57     |(?P<url>(?<!"|')http://\S*) # http://something, where http is not preceded with " or ' 
     57    |(?P<url>(?<!"|'|=)http://\S*) # http://something, where http is not preceded with " or ' 
    5858    |(?P<bracket>\[.*?\]) # everything that is put inside brackets 
    5959    |(?P<tex>\\\(.*?\\\)) # tex should be written inside \( ... \)  
  • trunk/skins/lemill/manage_convert.pt

    r1942 r2048  
    4141        <h2 tal:condition="to_obj_type" tal:content="to_obj_type" /> 
    4242        <select tal:condition="not:to_obj_type" name="to_obj_type"> 
     43            <option value="ExerciseMaterial" tal:condition="python:here.portal_type!='ExerciseMaterial'">Exercise Material</option> 
    4344            <option value="MultimediaMaterial" tal:condition="python:here.portal_type!='MultimediaMaterial'">Multimedia Material</option> 
    4445            <option value="LeMillReference" tal:condition="python:here.portal_type!='LeMillReference'">Reference</option> 
  • trunk/tests/LeMillTestCase.py

    r1930 r2048  
    101101        return result 
    102102 
    103     def cookText(self,text): 
    104         """ This should mirror cookText-script skins/lemill/cookText.py """ 
    105         lt=getToolByName(self.portal, 'lemill_tool') 
    106         if type(text)==list or type(text)==tuple: 
    107             return [lt.shorten_link_names(lt.htmlify(x)) for x in text] 
    108         return lt.shorten_link_names(lt.htmlify(text)) 
    109  
  • trunk/tests/testActivity.py

    r1631 r2048  
    6969        ob=self.construct('Activity', 'getbodytext test', self.portal.methods) 
    7070        ob.edit(bodyText='huigrehr\ngyuiwgre\n\nhuigrwegr\nhttp://index.hu/huigrehgr/hrehuwigw/ehreuqihgrehr/ehjreugihrtre/htjreuihreuige/gre/gre/gr') 
    71         self.assertEqual(self.cookText(ob.getBodyText()), 'huigrehr<br />gyuiwgre</p><p>huigrwegr<br /><a href="http://index.hu/huigrehgr/hrehuwigw/ehreuqihgrehr/ehjreugihrtre/htjreuihreuige/gre/gre/gr">http://index.hu/.../gr</a>') 
     71        self.assertEqual(ob.getBodyText(), 'huigrehr<br/>\ngyuiwgre<br/>\n<br/>\nhuigrwegr<br/>\n<a href="http://index.hu/huigrehgr/hrehuwigw/ehreuqihgrehr/ehjreugihrtre/htjreuihreuige/gre/gre/gr">http://index.hu/huigrehgr/hrehuwigw/ehreuqihgrehr/ehjreugihr<br/>tre/htjreuihreuige/gre/gre/gr</a>') 
    7272 
    7373     
  • trunk/tests/testFolderBrowsing.py

    r1624 r2048  
    4444        self.addUser('foobar','foobar') 
    4545        self.login('foobar') 
    46  
    47     def testPopularSearch(self): 
    48         TITLE='Test' 
    49         BODY='Test paragraph' 
    50         TAGS='Academic' 
    51         TAGS_later = TAGS.lower() 
    52         ob=self.construct('PresentationMaterial', 'TestMaterial2' ,self.portal.content) 
    53         ob.edit(title=TITLE, bodyText=BODY, tags=TAGS) 
    54  
    55         path=self.portal.content.absolute_url_path() 
    56         result=self.publish(path).getBody() 
    57         self.failUnless(result.find(TAGS_later) != -1,"The popular browse-by choice is not visible in folder index.") 
    58          
    59         path=self.portal.methods.absolute_url_path() 
    60         result=self.publish(path).getBody() 
    61         self.failIf(result.find(TAGS_later) != -1, "The popular browse-by choice is visible in wrong folder.") 
    6246 
    6347    def testTagCloud(self): 
  • trunk/tests/testGroups.py

    r1930 r2048  
    124124        ob = self.construct('BlogPost','TestPost',self.portal.community.testgroup) 
    125125        ob.processForm(values={'title':TITLE,'bodyText':'huigrehr\ngyuiwgre\n\nhuigrwegr\nhttp://index.hu/huigrehgr/hrehuwigw/ehreuqihgrehr/ehjreugihrtre/htjreuihreuige/gre/gre/gr'}) 
    126         self.assertEqual(self.cookText(ob.getBodyText()), 'huigrehr<br />gyuiwgre</p><p>huigrwegr<br /><a href="http://index.hu/huigrehgr/hrehuwigw/ehreuqihgrehr/ehjreugihrtre/htjreuihreuige/gre/gre/gr">http://index.hu/.../gr</a>') 
     126        self.assertEqual(ob.getBodyText(), 'huigrehr<br/>\ngyuiwgre<br/>\n<br/>\nhuigrwegr<br/>\n<a href="http://index.hu/huigrehgr/hrehuwigw/ehreuqihgrehr/ehjreugihrtre/htjreuihreuige/gre/gre/gr">http://index.hu/huigrehgr/hrehuwigw/ehreuqihgrehr/ehjreugihr<br/>tre/htjreuihreuige/gre/gre/gr</a>') 
    127127 
    128128    def testBlogPostsInCommunityFrontPage(self): 
  • trunk/tests/testMaterial.py

    r1807 r2048  
    165165<a href="http:lemill.net">This is fine</a> My truth > your truth.''' 
    166166        ]) 
    167         self.assertEqual(self.cookText(ob.getBodyText()), ['<a href="http://index.hu">http://index.hu</a>', 'huigrehr<br />gyuiwgre</p><p>huigrwegr<br /><a href="http://index.hu/huigrehgr/hrehuwigw/ehreuqihgrehr/ehjreugihrtre/htjreuihreuige/gre/gre/gr">http://index.hu/.../gr</a>', '''<a href="http://127.0.0.1:8080/lemill-server/content/mis-on-programmeerimine/edit?edit=1&portal_status_message=Changes%20saved.#1">http://127.0.0.1:8080/.../edit?edit=1&portal_status_message=Changes%20saved.#1</a></p><p>but, 5 &lt; 6 and 7&gt;3.</p><p><a href="http:lemill.net">This is fine</a> My truth &gt; your truth.''']) 
     167        self.assertEqual(ob.getBodyText(), ['<a href="http://index.hu">http://index.hu</a>', 'huigrehr<br/>\ngyuiwgre<br/>\n<br/>\nhuigrwegr<br/>\n<a href="http://index.hu/huigrehgr/hrehuwigw/ehreuqihgrehr/ehjreugihrtre/htjreuihreuige/gre/gre/gr">http://index.hu/huigrehgr/hrehuwigw/ehreuqihgrehr/ehjreugihr<br/>tre/htjreuihreuige/gre/gre/gr</a>', '<a href="http://127.0.0.1:8080/lemill-server/content/mis-on-programmeerimine/edit?edit=1&portal_status_message=Changes%20saved.#1">http://127.0.0.1:8080/lemill-server/content/mis-on-programme<br/>erimine/edit?edit=1&portal_status_message=Changes%20saved.#1</a><br/>\n<br/>\nbut, 5 < 6 and 7>3.<br/>\n<br/>\n<a href="http:lemill.net">This is fine</a> My truth > your truth.']) 
     168 
    168169 
    169170    def testEmbedTags(self): 
     
    171172        ob=self.construct('MultimediaMaterial', 'getbodytext test', self.portal.content) 
    172173        ob.edit(bodyText=embed) 
    173         self.assertEqual(self.cookText(ob.getBodyText()), [embed]) 
     174        self.assertEqual(ob.getBodyText(), [embed]) 
    174175 
    175176 
  • trunk/tests/testPilotMaterial.py

    r1807 r2048  
    7575        bt = ['http://index.hu', 'huigrehr\ngyuiwgre\n\nhuigrwegr\nhttp://index.hu/huigrehgr/hrehuwigw/ehreuqihgrehr/ehjreugihrtre/htjreuihreuige/gre/gre/gr', ['', '', '']] 
    7676        ob.edit(bodyText=bt) 
    77         self.assertEqual(ob.getBodyText(), bt) 
     77        self.assertEqual(ob.getBodyText(), ['<a href="http://index.hu">http://index.hu</a>', 'huigrehr<br/>\ngyuiwgre<br/>\n<br/>\nhuigrwegr<br/>\n<a href="http://index.hu/huigrehgr/hrehuwigw/ehreuqihgrehr/ehjreugihrtre/htjreuihreuige/gre/gre/gr">http://index.hu/huigrehgr/hrehuwigw/ehreuqihgrehr/ehjreugihr<br/>tre/htjreuihreuige/gre/gre/gr</a>', ['','','']]) 
    7878        
    7979class TestMaterialPieces(LeMillTestCase): 
  • trunk/tests/testPresentation.py

    r1807 r2048  
    8080        ob=self.construct('PresentationMaterial', 'getbodytext test', self.portal.content) 
    8181        ob.edit(bodyText=['http://index.hu', 'huigrehr\ngyuiwgre\n\nhuigrwegr\nhttp://index.hu/huigrehgr/hrehuwigw/ehreuqihgrehr/ehjreugihrtre/htjreuihreuige/gre/gre/gr']) 
    82         self.assertEqual(self.cookText(ob.getBodyText()), ['<a href="http://index.hu">http://index.hu</a>', 'huigrehr<br />gyuiwgre</p><p>huigrwegr<br /><a href="http://index.hu/huigrehgr/hrehuwigw/ehreuqihgrehr/ehjreugihrtre/htjreuihreuige/gre/gre/gr">http://index.hu/.../gr</a>']) 
     82        self.assertEqual(ob.getBodyText(), ['<a href="http://index.hu">http://index.hu</a>', 'huigrehr<br/>\ngyuiwgre<br/>\n<br/>\nhuigrwegr<br/>\n<a href="http://index.hu/huigrehgr/hrehuwigw/ehreuqihgrehr/ehjreugihrtre/htjreuihreuige/gre/gre/gr">http://index.hu/huigrehgr/hrehuwigw/ehreuqihgrehr/ehjreugihr<br/>tre/htjreuihreuige/gre/gre/gr</a>']) 
    8383 
    8484class TestMaterialPieces(LeMillTestCase): 
  • trunk/tests/testResources.py

    r1607 r2048  
    3737 
    3838    def testHtmlify(self): 
    39         self.assertEqual(self.lt.htmlify(''), '') 
     39        self.assertEqual(self.lt.parse_text(''), '') 
    4040        html = '<p>hthtrehtre</p>' 
    41         self.assertEqual(self.lt.htmlify(html), html) 
    42         self.assertEqual(self.lt.htmlify('hgrehhhherhre\nhtrhtr'), 'hgrehhhherhre<br />htrhtr') 
     41        self.assertEqual(self.lt.parse_text(html), html) 
     42        self.assertEqual(self.lt.parse_text('hgrehhhherhre\nhtrhtr'), 'hgrehhhherhre<br/>\nhtrhtr') 
    4343        link = 'http://index.hu' 
    44         self.assertEqual(self.lt.htmlify('http://index.hu'), '<a href="http://index.hu">http://index.hu</a>') 
     44        self.assertEqual(self.lt.parse_text('http://index.hu'), '<a href="http://index.hu">http://index.hu</a>') 
    4545 
    4646    def testShortenLinkNames(self): 
    47         l1 = self.lt.htmlify('http://index.hu') 
    48         self.assertEqual(self.lt.shorten_link_names(l1), l1) 
    49         l2 = self.lt.htmlify('http://index.hu/htreh/htrerwegrehtre/ehrehrehtr/gerhre/hehrehe/gre') 
    50         self.assertEqual(self.lt.shorten_link_names(l2), '<a href="http://index.hu/htreh/htrerwegrehtre/ehrehrehtr/gerhre/hehrehe/gre">http://index.hu/.../gre</a>') 
     47        l2 = 'http://index.hu/htreh/htrerwegrehtre/ehrehrehtr/gerhre/hehrehe/gre' 
     48        self.assertEqual(self.lt.parse_text(l2), '<a href="http://index.hu/htreh/htrerwegrehtre/ehrehrehtr/gerhre/hehrehe/gre">http://index.hu/htreh/htrerwegrehtre/ehrehrehtr/gerhre/hehre<br/>he/gre</a>') 
    5149 
    5250    def testSplitAtPOrBr(self): 
  • trunk/tests/testTool.py

    r1631 r2048  
    7070        ob=self.construct('Tool', 'getbodytext test', self.portal.tools) 
    7171        ob.edit(bodyText='huigrehr\ngyuiwgre\n\nhuigrwegr\nhttp://index.hu/huigrehgr/hrehuwigw/ehreuqihgrehr/ehjreugihrtre/htjreuihreuige/gre/gre/gr') 
    72         self.assertEqual(self.cookText(ob.getBodyText()), 'huigrehr<br />gyuiwgre</p><p>huigrwegr<br /><a href="http://index.hu/huigrehgr/hrehuwigw/ehreuqihgrehr/ehjreugihrtre/htjreuihreuige/gre/gre/gr">http://index.hu/.../gr</a>') 
     72        self.assertEqual(ob.getBodyText(), 'huigrehr<br/>\ngyuiwgre<br/>\n<br/>\nhuigrwegr<br/>\n<a href="http://index.hu/huigrehgr/hrehuwigw/ehreuqihgrehr/ehjreugihrtre/htjreuihreuige/gre/gre/gr">http://index.hu/huigrehgr/hrehuwigw/ehreuqihgrehr/ehjreugihr<br/>tre/htjreuihreuige/gre/gre/gr</a>') 
    7373 
    7474 
Note: See TracChangeset for help on using the changeset viewer.