def test_no_links_in_text(self): self.replay() result = helpers.make_links_absolute(self.obj, 'text with no links') self.assertEquals(result, 'text with no links')
def test_with_links_in_text_but_not_found(self): self.expect( self.obj.restrictedTraverse('rel_link', ANY)).result(None) text = 'text with <a href="rel_link">My Link</a>' self.replay() result = helpers.make_links_absolute(self.obj, text) self.assertEquals(result, text)
def test_with_links_in_text(self): self.expect(self.obj.restrictedTraverse('rel_link', ANY)).result( self.obj) self.expect(self.obj.absolute_url()).result('absolute_link') self.replay() result = helpers.make_links_absolute( self.obj, 'text with <a href="rel_link">My Link</a>') self.assertEquals( result, 'text with <a href="absolute_link">My Link</a>')