comparison tests/FeedUpdaterTests.py @ 9:fd4c8bfa62d6

FeedUpdater throws an exception if the URL could not be retrieved successfully. Includes unit tests.
author Dirk Olmes <dirk@xanthippe.ping.de>
date Tue, 27 Apr 2010 10:22:35 +0200
parents
children bb3c851b18b1
comparison
equal deleted inserted replaced
8:2da2b691345d 9:fd4c8bfa62d6
1
2 import unittest
3 from Feed import Feed
4 from FeedUpdater import FeedUpdater
5 from FeedUpdater import FeedUpdateException
6
7 class FeedUpdaterTests(unittest.TestCase):
8 def testFeedContainsInvalidUrl(self):
9 feed = Feed("invalid", "http://thisurldoesnotexist.xxx")
10 try:
11 FeedUpdater(None, feed).update()
12 self.fail("updating an invalid URL must fail")
13 except FeedUpdateException:
14 # this one was expected
15 pass
16
17 def testFeedContainsValidUrl(self):
18 feed = Feed("valid", "http://www.joelonsoftware.com/rss.xml")
19 result = FeedUpdater(None, feed).getFeed()
20 self.assertEqual("Joel on Software", result["feed"].title)
21
22 if __name__ == "__main__":
23 #import sys;sys.argv = ['', 'Test.testName']
24 unittest.main()