diff -r f6c9a5df80fb -r a5432f99f2d9 test/unittest_entity.py --- a/test/unittest_entity.py Wed Sep 30 18:57:42 2009 +0200 +++ b/test/unittest_entity.py Wed Oct 07 12:31:08 2009 +0200 @@ -306,11 +306,11 @@ def test_printable_value_bytes(self): e = self.add_entity('File', data=Binary('lambda x: 1'), data_format=u'text/x-python', - data_encoding=u'ascii', name=u'toto.py') + data_encoding=u'ascii', data_name=u'toto.py') from cubicweb.common import mttransforms if mttransforms.HAS_PYGMENTS_TRANSFORMS: self.assertEquals(e.printable_value('data'), - '''
lambda x: 1
+                              '''
lambda x: 1
 
''') else: @@ -321,7 +321,7 @@ ''') e = self.add_entity('File', data=Binary('*héhéhé*'), data_format=u'text/rest', - data_encoding=u'utf-8', name=u'toto.txt') + data_encoding=u'utf-8', data_name=u'toto.txt') self.assertEquals(e.printable_value('data'), u'

héhéhé

\n') @@ -348,6 +348,21 @@ e['content'] = u'C'est un exemple sérieux' self.assertEquals(tidy(e.printable_value('content')), u"C'est un exemple sérieux") + # make sure valid xhtml is left untouched + e['content'] = u'
R&D
' + self.assertEquals(e.printable_value('content'), e['content']) + e['content'] = u'
été
' + self.assertEquals(e.printable_value('content'), e['content']) + e['content'] = u'été' + self.assertEquals(e.printable_value('content'), e['content']) + e['content'] = u'hop\r\nhop\nhip\rmomo' + self.assertEquals(e.printable_value('content'), u'hop\nhop\nhip\nmomo') + + def test_printable_value_bad_html_ms(self): + self.skip('fix soup2xhtml to handle this test') + e = self.add_entity('Card', title=u'bad html', content=u'
R&D
', + content_format=u'text/html') + tidy = lambda x: x.replace('\n', '') e['content'] = u'
ms orifice produces weird html
' self.assertEquals(tidy(e.printable_value('content')), u'
ms orifice produces weird html
') @@ -360,25 +375,17 @@ 'char_encoding' : 'utf8'})).decode('utf-8').strip() self.assertEquals(tidy(e.printable_value('content')), u'
ms orifice produces weird html
') - # make sure valid xhtml is left untouched - e['content'] = u'
R&D
' - self.assertEquals(e.printable_value('content'), e['content']) - e['content'] = u'
été
' - self.assertEquals(e.printable_value('content'), e['content']) - e['content'] = u'été' - self.assertEquals(e.printable_value('content'), e['content']) - e['content'] = u'hop\r\nhop\nhip\rmomo' - self.assertEquals(e.printable_value('content'), u'hop\nhop\nhip\nmomo') def test_fulltextindex(self): e = self.vreg['etypes'].etype_class('File')(self.request()) - e['name'] = 'an html file' e['description'] = 'du html' e['description_format'] = 'text/html' e['data'] = Binary('some data') + e['data_name'] = 'an html file' e['data_format'] = 'text/html' e['data_encoding'] = 'ascii' + e.req.transaction_data = {} # XXX req should be a session self.assertEquals(set(e.get_words()), set(['an', 'html', 'file', 'du', 'html', 'some', 'data'])) @@ -401,7 +408,7 @@ self.failUnless(trinfo.relation_cached('from_state', 'subject')) self.failUnless(trinfo.relation_cached('to_state', 'subject')) self.failUnless(trinfo.relation_cached('wf_info_for', 'subject')) - self.assertEquals(trinfo.by_transition, []) + self.assertEquals(trinfo.by_transition, ()) def test_request_cache(self): req = self.request()