Commit ad11ab67 authored by Nicolas Wavrant's avatar Nicolas Wavrant

checkfeedaspromise: do not fail if feed contains no item

parent 50948d5b
......@@ -43,6 +43,9 @@ def checkFeedAsPromise(feed, option):
if feed.bozo:
return 'Feed malformed'
if len(feed.entries) == 0:
return ''
last_item = feed.entries[-1]
if option.title:
candidate_string = last_item.title
......
......@@ -118,5 +118,13 @@ class TestCheckFeedAsPromise(unittest.TestCase):
self.assertNotEquals(len(checkFeedAsPromise(feed, option)), 0)
def test_noItemInTheFeedIsNotAnError(self):
option = self.getOptionObject()
option.title = True
feed = self.generateFeed([])
self.assertEquals(checkFeedAsPromise(feed, option), "")
if __name__ == '__main__':
unittest.main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment