Beispiel #1
0
 def test_extra_keys(self):
     url = ('http://subscribe.getdemocracy.com/'
            '?url1=http%3A//www.myblog.com/rss'
            '&description1=My+Blog'
             '&title1=My+Item'
             '&length1=12345'
             '&type1=video/mp4'
             '&thumbnail1=http%3A//pculture.org/image.jpeg'
             '&feed1=http%3A//pculture.org/feed.xml'
             '&link1=http%3A//pculture.org/page.html'
             '&trackback1=http%3A//pculture.org/trackpack.cgi'
             '&section1=audio')
     feeds = subscription.find_subscribe_links(url)
     self.assertEquals(len(feeds), 1)
     self.assertDictEquals(feeds[0],
         {'url': u'http://www.myblog.com/rss', 'type': 'feed',
             'description': u'My Blog',
             'title': u'My Item',
             'length': u'12345',
             'mime_type': 'video/mp4',
             'thumbnail': 'http://pculture.org/image.jpeg',
             'feed': 'http://pculture.org/feed.xml',
             'link': 'http://pculture.org/page.html',
             'trackback': 'http://pculture.org/trackpack.cgi',
             'section': u'audio',
     })
Beispiel #2
0
 def test_link_in_path(self):
     url = 'http://subscribe.getdemocracy.com/http%3A//www.myblog.com/rss'
     self.assertEquals(subscription.find_subscribe_links(url),
                       [{
                           'type': 'feed',
                           'url': 'http://www.myblog.com/rss'
                       }])
Beispiel #3
0
 def test_extra_keys(self):
     url = ('http://subscribe.getdemocracy.com/'
            '?url1=http%3A//www.myblog.com/rss'
            '&description1=My+Blog'
            '&title1=My+Item'
            '&length1=12345'
            '&type1=video/mp4'
            '&thumbnail1=http%3A//pculture.org/image.jpeg'
            '&feed1=http%3A//pculture.org/feed.xml'
            '&link1=http%3A//pculture.org/page.html'
            '&trackback1=http%3A//pculture.org/trackpack.cgi')
     feeds = subscription.find_subscribe_links(url)
     self.assertEquals(len(feeds), 1)
     self.assertDictEquals(
         feeds[0], {
             'url': u'http://www.myblog.com/rss',
             'type': 'feed',
             'description': u'My Blog',
             'title': u'My Item',
             'length': u'12345',
             'mime_type': 'video/mp4',
             'thumbnail': 'http://pculture.org/image.jpeg',
             'feed': 'http://pculture.org/feed.xml',
             'link': 'http://pculture.org/page.html',
             'trackback': 'http://pculture.org/trackpack.cgi',
         })
Beispiel #4
0
 def test_download_links(self):
     url = ('http://subscribe.getdemocracy.com/download.php' +
            '?url1=http%3A//www.myblog.com/videos/cats.ogm')
     self.assertEquals(subscription.find_subscribe_links(url),
                       [{
                           'type': 'download',
                           'url': 'http://www.myblog.com/videos/cats.ogm'
                       }])
Beispiel #5
0
 def test_site_links(self):
     url = ('http://subscribe.getdemocracy.com/site.php' +
            '?url1=http%3A//www.mychannelguide.com/')
     self.assertEquals(subscription.find_subscribe_links(url),
                       [{
                           'type': 'site',
                           'url': 'http://www.mychannelguide.com/'
                       }])
Beispiel #6
0
 def test_link_in_query(self):
     url = ('http://subscribe.getdemocracy.com/' + \
            '?url1=http%3A//www.myblog.com/rss')
     self.assertEquals(subscription.find_subscribe_links(url),
                       [{
                           'type': 'feed',
                           'url': 'http://www.myblog.com/rss'
                       }])
Beispiel #7
0
    def test_query_encoded_wrong(self):
        # Test queries with invalid encodings (#13390)
        url = ('http://subscribe.getdemocracy.com/' + \
               '?url1=http%3A//www.myblog.com/rss' + \
               '&description1=My%A0Blog') # %A0 is not correct here

        feeds = subscription.find_subscribe_links(url)
        self.assertEquals(feeds, [
            {'url': u'http://www.myblog.com/rss', 'type': 'feed',
                'description': u'My\ufffdBlog'}] # fffd is the ? character
        )
Beispiel #8
0
    def test_multiple_links_in_query(self):
        url = ('http://subscribe.getdemocracy.com/' + \
               '?url1=http%3A//www.myblog.com/rss' + \
               '&url2=http%3A//www.yourblog.com/atom' + \
               '&url3=http%3A//www.herblog.com/scoobydoo')

        feeds = subscription.find_subscribe_links(url)
        for feed in feeds:
            self.assertEquals(feed['type'], 'feed')
        # have to sort them because they could be in any order
        links = [feed['url'] for feed in feeds]
        links.sort()
        self.assertEquals(links, ['http://www.herblog.com/scoobydoo',
                                  'http://www.myblog.com/rss',
                                  'http://www.yourblog.com/atom'])
 def test_link_in_query(self):
     url = ('http://subscribe.getdemocracy.com/' + \
            '?url1=http%3A//www.myblog.com/rss')
     self.assertEquals(subscription.find_subscribe_links(url),
             [{'type': 'feed', 'url':'http://www.myblog.com/rss'}])
 def test_link_in_path(self):
     url = 'http://subscribe.getdemocracy.com/http%3A//www.myblog.com/rss'
     self.assertEquals(subscription.find_subscribe_links(url),
             [{'type': 'feed', 'url': 'http://www.myblog.com/rss'}])
Beispiel #11
0
 def test_no_links(self):
     url = 'http://subscribe.getdemocracy.com/'
     self.assertEquals(subscription.find_subscribe_links(url), [])
Beispiel #12
0
 def test_different_host(self):
     url = 'http://youtoob.com'
     self.assertEquals(subscription.find_subscribe_links(url), [])
Beispiel #13
0
 def test_garbage(self):
     url = 5
     self.assertEquals(subscription.find_subscribe_links(url), [])
 def test_site_links(self):
     url = ('http://subscribe.getdemocracy.com/site.php' +
            '?url1=http%3A//www.mychannelguide.com/')
     self.assertEquals(subscription.find_subscribe_links(url),
             [{'type': 'site', 'url': 'http://www.mychannelguide.com/'}])
Beispiel #15
0
 def test_garbage(self):
     url = 5
     with self.allow_warnings():
         self.assertEquals(subscription.find_subscribe_links(url), [])
 def test_download_links(self):
     url = ('http://subscribe.getdemocracy.com/download.php' +
            '?url1=http%3A//www.myblog.com/videos/cats.ogm')
     self.assertEquals(subscription.find_subscribe_links(url),
             [{'type': 'download',
               'url': 'http://www.myblog.com/videos/cats.ogm'}])
Beispiel #17
0
 def test_garbage(self):
     url = 5
     self.assertEquals(subscription.find_subscribe_links(url), [])