def test_something_else(self): """Something that does not have getText nor text""" class Dummy(object): pass self.assertEqual( get_text_from_object(Dummy()), '' )
def test_contentish_like(self): """Dexterity content types and comments have a text method""" class DummyDXComment(object): @property def text(self): return 'found!' self.assertEqual( get_text_from_object(DummyDXComment()), 'found!' )
def test_event_with_comment_like(self): """Comment wrapped in an event""" class DummyComment(object): @property def text(self): return 'found!' class DummyEventComment(object): @property def comment(self): return DummyComment() self.assertEqual( get_text_from_object(DummyEventComment()), 'found!' )
def test_event_with_contentish_like(self): """Content type wrapped in an event""" class DummyDX(object): @property def text(self): return 'found!' class DummyEventDX(object): @property def object(self): return DummyDX() self.assertEqual( get_text_from_object(DummyEventDX()), 'found!' )