Ejemplo n.º 1
0
    def test_generate_pingback_content(self):
        soup = BeautifulSoup(self.second_entry.content)
        target = 'http://%s%s' % (self.site.domain, self.first_entry.get_absolute_url())

        self.assertEquals(generate_pingback_content(soup, target, 1000),
                          'My second content with link to first entry and '\
                          'other links : http://localhost:8000/404/ http://example.com/.')

        self.assertEquals(generate_pingback_content(soup, target, 50),
                          '...ond content with link to first entry and other link...')
    def test_generate_pingback_content(self):
        soup = BeautifulSoup(self.second_entry.content)
        target = "http://%s%s" % (self.site.domain, self.first_entry.get_absolute_url())

        self.assertEqual(
            generate_pingback_content(soup, target, 1000),
            "My second content with link to first entry and other links : "
            "http://example.com/error-404/ http://external/.",
        )
        self.assertEqual(
            generate_pingback_content(soup, target, 50), "...ond content with link to first entry and other lin..."
        )

        soup = BeautifulSoup('<a href="%s">test link</a>' % target)
        self.assertEqual(generate_pingback_content(soup, target, 6), "test l...")

        soup = BeautifulSoup('test <a href="%s">link</a>' % target)
        self.assertEqual(generate_pingback_content(soup, target, 8), "...est link")
        self.assertEqual(generate_pingback_content(soup, target, 9), "test link")
Ejemplo n.º 3
0
    def test_generate_pingback_content(self):
        soup = BeautifulSoup(self.second_entry.content)
        target = 'http://%s%s' % (self.site.domain,
                                  self.first_entry.get_absolute_url())

        self.assertEquals(generate_pingback_content(soup, target, 1000),
                          'My second content with link to first entry and '\
                          'other links : http://localhost:8000/404/ http://example.com/.')
        self.assertEquals(
            generate_pingback_content(soup, target, 50),
            '...ond content with link to first entry and other lin...')

        soup = BeautifulSoup('<a href="%s">test link</a>' % target)
        self.assertEquals(generate_pingback_content(soup, target, 6),
                          'test l...')

        soup = BeautifulSoup('test <a href="%s">link</a>' % target)
        self.assertEquals(generate_pingback_content(soup, target, 8),
                          '...est link')
        self.assertEquals(generate_pingback_content(soup, target, 9),
                          'test link')
Ejemplo n.º 4
0
    def test_generate_pingback_content(self):
        soup = BeautifulSoup(self.second_entry.content)
        target = 'http://%s%s' % (self.site.domain,
                                  self.first_entry.get_absolute_url())

        self.assertEqual(
            generate_pingback_content(soup, target, 1000),
            'My second content with link to first entry and other links : '
            'http://localhost:8000/error-404/ http://example.com/.')
        self.assertEqual(
            generate_pingback_content(soup, target, 50),
            '...ond content with link to first entry and other lin...')

        soup = BeautifulSoup('<a href="%s">test link</a>' % target)
        self.assertEqual(
            generate_pingback_content(soup, target, 6), 'test l...')

        soup = BeautifulSoup('test <a href="%s">link</a>' % target)
        self.assertEqual(
            generate_pingback_content(soup, target, 8), '...est link')
        self.assertEqual(
            generate_pingback_content(soup, target, 9), 'test link')
Ejemplo n.º 5
0
    def test_generate_pingback_content(self):
        soup = BeautifulSoup(self.second_entry.content, 'html.parser')
        target = 'http://%s%s' % (self.site.domain,
                                  self.first_entry.get_absolute_url())

        self.assertEqual(
            generate_pingback_content(soup, target, 1000),
            'My second content with link to first entry and other links : '
            'http://example.com/error-404/ http://external/.')
        self.assertEqual(
            generate_pingback_content(soup, target, 50),
            '...ond content with link to first entry and other lin...')

        soup = BeautifulSoup('<a href="%s">test link</a>' % target,
                             'html.parser')
        self.assertEqual(
            generate_pingback_content(soup, target, 6), 'test l...')

        soup = BeautifulSoup('test <a href="%s">link</a>' % target,
                             'html.parser')
        self.assertEqual(
            generate_pingback_content(soup, target, 8), '...est link')
        self.assertEqual(
            generate_pingback_content(soup, target, 9), 'test link')