Beispiel #1
0
 def test_find_external_urls(self):
     r = URLRessources()
     external_urls = self.pinger.find_external_urls(self.entry)
     self.assertEquals(external_urls, [])
     self.entry.content = """
     <p>This is a <a href="http://fantomas.willbreak.it/">link</a> to a site.</p>
     <p>This is a <a href="%s/blog/">link</a> within my site.</p>
     <p>This is a <a href="/blog/">relative link</a> within my site.</p>
     """ % r.site_url
     self.entry.save()
     external_urls = self.pinger.find_external_urls(self.entry)
     self.assertEquals(external_urls, ['http://fantomas.willbreak.it/'])
Beispiel #2
0
 def test_is_external_url(self):
     r = URLRessources()
     self.assertEquals(self.pinger.is_external_url(
         'http://example.com/', 'http://google.com/'), True)
     self.assertEquals(self.pinger.is_external_url(
         'http://example.com/toto/', 'http://google.com/titi/'), True)
     self.assertEquals(self.pinger.is_external_url(
         'http://example.com/blog/', 'http://example.com/page/'), False)
     self.assertEquals(self.pinger.is_external_url(
         '%s/blog/' % r.site_url, r.site_url), False)
     self.assertEquals(self.pinger.is_external_url(
         'http://google.com/', r.site_url), True)
     self.assertEquals(self.pinger.is_external_url(
         '/blog/', r.site_url), False)
Beispiel #3
0
 def test_is_external_url(self):
     r = URLRessources()
     pinger = ExternalUrlsPinger(self.entry, start_now=False)
     self.assertEqual(
         pinger.is_external_url('http://example.com/',
                                'http://google.com/'), True)
     self.assertEqual(
         pinger.is_external_url('http://example.com/toto/',
                                'http://google.com/titi/'), True)
     self.assertEqual(
         pinger.is_external_url('http://example.com/blog/',
                                'http://example.com/page/'), False)
     self.assertEqual(
         pinger.is_external_url('%s/blog/' % r.site_url, r.site_url), False)
     self.assertEqual(
         pinger.is_external_url('http://google.com/', r.site_url), True)
     self.assertEqual(pinger.is_external_url('/blog/', r.site_url), False)