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' '§ion1=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', })
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' }])
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', })
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' }])
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/' }])
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_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 )
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'}])
def test_no_links(self): url = 'http://subscribe.getdemocracy.com/' self.assertEquals(subscription.find_subscribe_links(url), [])
def test_different_host(self): url = 'http://youtoob.com' self.assertEquals(subscription.find_subscribe_links(url), [])
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/'}])
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'}])