示例#1
0
    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')
示例#2
0
    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)
示例#3
0
    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>')