hooks/test/unittest_hooks.py
changeset 7245 2f72b958ae22
parent 7244 a918f76441ce
child 7791 31bb51ea5485
equal deleted inserted replaced
7244:a918f76441ce 7245:2f72b958ae22
    40         rset = self.execute('Any S WHERE X sender S, X eid %s' % eeid)
    40         rset = self.execute('Any S WHERE X sender S, X eid %s' % eeid)
    41         self.assertEqual(len(rset), 1)
    41         self.assertEqual(len(rset), 1)
    42 
    42 
    43     def test_html_tidy_hook(self):
    43     def test_html_tidy_hook(self):
    44         req = self.request()
    44         req = self.request()
    45         entity = req.create_entity('Workflow', name=u'wf1', description_format=u'text/html',
    45         entity = req.create_entity('Workflow', name=u'wf1',
    46                                  description=u'yo')
    46                                    description_format=u'text/html',
       
    47                                    description=u'yo')
    47         self.assertEqual(entity.description, u'yo')
    48         self.assertEqual(entity.description, u'yo')
    48         entity = req.create_entity('Workflow', name=u'wf2', description_format=u'text/html',
    49         entity = req.create_entity('Workflow', name=u'wf2',
    49                                  description=u'<b>yo')
    50                                    description_format=u'text/html',
       
    51                                    description=u'<b>yo')
    50         self.assertEqual(entity.description, u'<b>yo</b>')
    52         self.assertEqual(entity.description, u'<b>yo</b>')
    51         entity = req.create_entity('Workflow', name=u'wf3', description_format=u'text/html',
    53         entity = req.create_entity('Workflow', name=u'wf3',
    52                                  description=u'<b>yo</b>')
    54                                    description_format=u'text/html',
       
    55                                    description=u'<b>yo</b>')
    53         self.assertEqual(entity.description, u'<b>yo</b>')
    56         self.assertEqual(entity.description, u'<b>yo</b>')
    54         entity = req.create_entity('Workflow', name=u'wf4', description_format=u'text/html',
    57         entity = req.create_entity('Workflow', name=u'wf4',
    55                                  description=u'<b>R&D</b>')
    58                                    description_format=u'text/html',
       
    59                                    description=u'<b>R&D</b>')
    56         self.assertEqual(entity.description, u'<b>R&amp;D</b>')
    60         self.assertEqual(entity.description, u'<b>R&amp;D</b>')
    57         entity = req.create_entity('Workflow', name=u'wf5', description_format=u'text/html',
    61         entity = req.create_entity('Workflow', name=u'wf5',
    58                                  description=u"<div>c&apos;est <b>l'ét&eacute;")
    62                                    description_format=u'text/html',
       
    63                                    description=u"<div>c&apos;est <b>l'ét&eacute;")
    59         self.assertEqual(entity.description, u"<div>c'est <b>l'été</b></div>")
    64         self.assertEqual(entity.description, u"<div>c'est <b>l'été</b></div>")
    60 
    65 
    61     def test_nonregr_html_tidy_hook_no_update(self):
    66     def test_nonregr_html_tidy_hook_no_update(self):
    62         entity = self.request().create_entity('Workflow', name=u'wf1', description_format=u'text/html',
    67         entity = self.request().create_entity('Workflow', name=u'wf1',
    63                                  description=u'yo')
    68                                               description_format=u'text/html',
       
    69                                               description=u'yo')
    64         entity.set_attributes(name=u'wf2')
    70         entity.set_attributes(name=u'wf2')
    65         self.assertEqual(entity.description, u'yo')
    71         self.assertEqual(entity.description, u'yo')
    66         entity.set_attributes(description=u'R&D<p>yo')
    72         entity.set_attributes(description=u'R&D<p>yo')
    67         entity.cw_attr_cache.pop('description')
    73         entity.cw_attr_cache.pop('description')
    68         self.assertEqual(entity.description, u'R&amp;D<p>yo</p>')
    74         self.assertEqual(entity.description, u'R&amp;D<p>yo</p>')