test/unittest_entity.py
changeset 6416 2ca48e45522e
parent 6415 b0b0f097a72d
child 6427 c8a5ac2d1eaa
equal deleted inserted replaced
6415:b0b0f097a72d 6416:2ca48e45522e
   338                           e.cw_attr_cache['content'])
   338                           e.cw_attr_cache['content'])
   339 
   339 
   340         e.cw_attr_cache['content'] = u'<b>yo (zou éà ;)</b>'
   340         e.cw_attr_cache['content'] = u'<b>yo (zou éà ;)</b>'
   341         e.cw_attr_cache['content_format'] = 'text/html'
   341         e.cw_attr_cache['content_format'] = 'text/html'
   342         self.assertEqual(e.printable_value('content', format='text/plain').strip(),
   342         self.assertEqual(e.printable_value('content', format='text/plain').strip(),
       
   343                          u'**yo (zou éà ;)**')
   343         if HAS_TAL:
   344         if HAS_TAL:
   344             e.cw_attr_cache['content'] = '<h1 tal:content="self/title">titre</h1>'
   345             e.cw_attr_cache['content'] = '<h1 tal:content="self/title">titre</h1>'
   345             e.cw_attr_cache['content_format'] = 'text/cubicweb-page-template'
   346             e.cw_attr_cache['content_format'] = 'text/cubicweb-page-template'
   346             self.assertEqual(e.printable_value('content'),
   347             self.assertEqual(e.printable_value('content'),
   347                               '<h1>zou</h1>')
   348                               '<h1>zou</h1>')
   394         e.cw_attr_cache['content'] = u'yo !! R&amp;D <div> pas fermé'
   395         e.cw_attr_cache['content'] = u'yo !! R&amp;D <div> pas fermé'
   395         self.assertEqual(tidy(e.printable_value('content')),
   396         self.assertEqual(tidy(e.printable_value('content')),
   396                          u'yo !! R&amp;D <div> pas fermé</div>')
   397                          u'yo !! R&amp;D <div> pas fermé</div>')
   397         e.cw_attr_cache['content'] = u'été <div> été'
   398         e.cw_attr_cache['content'] = u'été <div> été'
   398         self.assertEqual(tidy(e.printable_value('content')),
   399         self.assertEqual(tidy(e.printable_value('content')),
       
   400                          u'été <div> été</div>')
   399         e.cw_attr_cache['content'] = u'C&apos;est un exemple s&eacute;rieux'
   401         e.cw_attr_cache['content'] = u'C&apos;est un exemple s&eacute;rieux'
   400         self.assertEqual(tidy(e.printable_value('content')),
   402         self.assertEqual(tidy(e.printable_value('content')),
   401         e['content'] = u'C&apos;est un exemple s&eacute;rieux'
   403                          u"C'est un exemple sérieux")
   402         self.assertEqual(tidy(e.printable_value('content')),
       
   403                           u"C'est un exemple sérieux")
       
   404         # make sure valid xhtml is left untouched
   404         # make sure valid xhtml is left untouched
   405         e.cw_attr_cache['content'] = u'<div>R&amp;D<br/></div>'
   405         e.cw_attr_cache['content'] = u'<div>R&amp;D<br/></div>'
   406         self.assertEqual(e.printable_value('content'), e.cw_attr_cache['content'])
   406         self.assertEqual(e.printable_value('content'), e.cw_attr_cache['content'])
   407         e.cw_attr_cache['content'] = u'<div>été</div>'
   407         e.cw_attr_cache['content'] = u'<div>été</div>'
   408         self.assertEqual(e.printable_value('content'), e.cw_attr_cache['content'])
   408         self.assertEqual(e.printable_value('content'), e.cw_attr_cache['content'])
   439         e.cw_attr_cache['data_name'] = 'an html file'
   439         e.cw_attr_cache['data_name'] = 'an html file'
   440         e.cw_attr_cache['data_format'] = 'text/html'
   440         e.cw_attr_cache['data_format'] = 'text/html'
   441         e.cw_attr_cache['data_encoding'] = 'ascii'
   441         e.cw_attr_cache['data_encoding'] = 'ascii'
   442         e._cw.transaction_data = {} # XXX req should be a session
   442         e._cw.transaction_data = {} # XXX req should be a session
   443         self.assertEqual(e.cw_adapt_to('IFTIndexable').get_words(),
   443         self.assertEqual(e.cw_adapt_to('IFTIndexable').get_words(),
   444                           {'C': [u'du', u'html', 'an', 'html', 'file', u'some', u'data']})
   444                           {'C': ['an', 'html', 'file', 'du', 'html', 'some', 'data']})
   445 
   445 
   446 
   446 
   447     def test_nonregr_relation_cache(self):
   447     def test_nonregr_relation_cache(self):
   448         req = self.request()
   448         req = self.request()
   449         p1 = req.create_entity('Personne', nom=u'di mascio', prenom=u'adrien')
   449         p1 = req.create_entity('Personne', nom=u'di mascio', prenom=u'adrien')