def testSortableNonASCIITitles(self): #test a utf-8 encoded string gets properly unicode converted title = 'La Pe\xc3\xb1a' doc = self.folder.doc doc.setTitle(title) wrapped = ExtensibleIndexableObjectWrapper(doc, self.portal) wrapped.update(vars={}) self.assertEqual(wrapped.sortable_title, u'la pe\xf1a'.encode('utf-8'))
def testWrapper(self): doc = self.doc vars = {'var' : 'a var'} wrapped = ExtensibleIndexableObjectWrapper(doc, self.portal) wrapped.update(vars) self.failUnlessEqual(wrapped.var, 'a var') self.failUnlessEqual(wrapped.getId(), 'doc') self.failUnlessEqual(wrapped.Title(), 'document') self.failUnlessEqual(wrapped.dummy, 'a dummy')
def test_provided(self): from Products.CMFCore.interfaces import IContentish from Products.CMFCore.interfaces import IIndexableObjectWrapper from Products.CMFCore.tests.base.dummy import DummyContent obj = DummyContent() w = ExtensibleIndexableObjectWrapper(obj, self.portal) w.update(vars={}) self.failUnless(IContentish.providedBy(w)) self.failUnless(IIndexableObjectWrapper.providedBy(w))
def testSortableTitleOutput(self): doc = self.folder.doc wrapped = ExtensibleIndexableObjectWrapper(doc, self.portal) wrapped.update(vars={}) self.assertEqual(wrapped.sortable_title, u'00000012 document 00000025')