diff --git a/plugins/RSS/test.py b/plugins/RSS/test.py index 5b9c88fb3..c0b4f7a67 100644 --- a/plugins/RSS/test.py +++ b/plugins/RSS/test.py @@ -42,6 +42,16 @@ xkcd_new = """ xkcd.comhttp://xkcd.com/xkcd.com: A webcomic of romance and math humor.enTelescopes: Refractor vs Reflectorhttp://xkcd.com/1791/<img src="http://imgs.xkcd.com/comics/telescopes_refractor_vs_reflector.png" title="On the other hand, the refractor's limited light-gathering means it's unable to make out shadow people or the dark god Chernabog." alt="On the other hand, the refractor's limited light-gathering means it's unable to make out shadow people or the dark god Chernabog." />Fri, 27 Jan 2017 05:00:00 -0000http://xkcd.com/1791/Chaoshttp://xkcd.com/1399/<img src="http://imgs.xkcd.com/comics/chaos.png" title="Although the oral exam for the doctorate was just 'can you do that weird laugh?'" alt="Although the oral exam for the doctorate was just 'can you do that weird laugh?'" />Fri, 25 Jul 2014 04:00:00 -0000http://xkcd.com/1399/Snake Factshttp://xkcd.com/1398/<img src="http://imgs.xkcd.com/comics/snake_facts.png" title="Biologically speaking, what we call a 'snake' is actually a human digestive tract which has escaped from its host." alt="Biologically speaking, what we call a 'snake' is actually a human digestive tract which has escaped from its host." />Wed, 23 Jul 2014 04:00:00 -0000http://xkcd.com/1398/ """ +not_well_formed = """ + + + this is missing a close tag + <link>http://example.com/</link> + <description>this dummy feed has no elements</description> + <language>en</language> +</channel> +</rss> +""" def constant(content): if minisix.PY3: @@ -322,6 +332,18 @@ class RSSTestCase(ChannelPluginTestCase): finally: feedparser._open_resource = old_open + def testBadlyFormedFeedWithNoItems(self): + # This combination will cause the RSS command to show the last parser + # error. + old_open = feedparser._open_resource + time.sleep(1.1) + feedparser._open_resource = constant(not_well_formed) + try: + self.assertRegexp('rss http://example.com/', + 'Parser error') + finally: + feedparser._open_resource = old_open + if network: def testRssinfo(self): time.sleep(1.1)