Commits

Ian Lewis  committed b22f2e2

Refactored tests a bit

  • Participants
  • Parent commits 522b30e

Comments (0)

Files changed (6)

File lifestream/fixtures/atom.json

-[
-    {
-        "pk": 100, 
-        "model": "lifestream.feed", 
-        "fields": {
-            "lifestream": 1, 
-            "name": "django-lifestream feed", 
-            "url": "http://127.0.0.1:8097/feeds/atom/bitbucket.xml",
-            "domain": "bitbucket.org", 
-            "fetchable": 1, 
-            "plugin_class_name": null 
-        }
-    },
-    {
-        "pk": 101, 
-        "model": "lifestream.feed", 
-        "fields": {
-            "lifestream": 1, 
-            "name": "Favorites of IanLewisInJapan", 
-            "url": "http://127.0.0.1:8097/feeds/atom/youtube_favorites.xml",
-            "domain": "youtube.com", 
-            "fetchable": 1, 
-            "plugin_class_name": "lifestream.plugins.youtube.YoutubePlugin" 
-        }
-    },
-    {
-        "pk": 102, 
-        "model": "lifestream.feed", 
-        "fields": {
-            "lifestream": 1, 
-            "name": "Ian Lewis' shared items in Google Reader", 
-            "url": "http://127.0.0.1:8097/feeds/atom/google_reader.xml",
-            "domain": "youtube.com", 
-            "fetchable": 1, 
-            "plugin_class_name": null
-        }
-    }
-] 

File lifestream/fixtures/bitbucket.json

+[
+    {
+        "pk": 1, 
+        "model": "lifestream.feed", 
+        "fields": {
+            "lifestream": 1, 
+            "name": "django-lifestream feed", 
+            "url": "http://127.0.0.1:8097/feeds/atom/bitbucket.xml",
+            "domain": "bitbucket.org", 
+            "fetchable": 1, 
+            "plugin_class_name": null 
+        }
+    },
+    {
+        "pk": 2, 
+        "model": "lifestream.feed", 
+        "fields": {
+            "lifestream": 1, 
+            "name": "django-lifestream feed", 
+            "url": "http://127.0.0.1:8097/feeds/rss/bitbucket.xml",
+            "domain": "bitbucket.org", 
+            "fetchable": 0, 
+            "plugin_class_name": null 
+        }
+    }
+] 

File lifestream/fixtures/ianlewis.json

+[
+    {
+        "pk": 1, 
+        "model": "lifestream.feed", 
+        "fields": {
+            "lifestream": 1, 
+            "name": "Ian Lewis' Blog", 
+            "url": "http://127.0.0.1:8097/feeds/rss/ianlewis.xml",
+            "domain": "ianlewis.org", 
+            "fetchable": 1, 
+            "plugin_class_name": null 
+        }
+    }
+] 

File lifestream/fixtures/rss.json

-[
-    {
-        "pk": 1, 
-        "model": "lifestream.feed", 
-        "fields": {
-            "lifestream": 1, 
-            "name": "django-lifestream feed", 
-            "url": "http://127.0.0.1:8097/feeds/rss/bitbucket.xml",
-            "domain": "bitbucket.org", 
-            "fetchable": 0, 
-            "plugin_class_name": null 
-        }
-    }, 
-    {
-        "pk": 2, 
-        "model": "lifestream.feed", 
-        "fields": {
-            "lifestream": 1, 
-            "name": "django-lifestream feed", 
-            "url": "http://127.0.0.1:8097/feeds/rss/ianlewis.xml",
-            "domain": "ianlewis.org", 
-            "fetchable": 1, 
-            "plugin_class_name": null 
-        }
-    }
-] 

File lifestream/fixtures/youtube.json

+[
+    {
+        "pk": 1, 
+        "model": "lifestream.feed", 
+        "fields": {
+            "lifestream": 1, 
+            "name": "Favorites of IanLewisInJapan", 
+            "url": "http://127.0.0.1:8097/feeds/atom/youtube_favorites.xml",
+            "domain": "youtube.com", 
+            "fetchable": 1, 
+            "plugin_class_name": "lifestream.plugins.youtube.YoutubePlugin" 
+        }
+    }
+] 

File lifestream/tests/feed_tests.py

 
 from lifestream.feeds import update_feeds
 
-class RssFeedTest(FeedTest):
-    fixtures = FeedTest.fixtures + ["rss.json"]
+class IanLewisFeedTest(FeedTest):
+    fixtures = FeedTest.fixtures + ["ianlewis.json"]
 
-    def test_bitbucket_feed(self):
+    def test_ianlewis_rss(self):
+        update_feeds()
+        self.assertEqual(Item.objects.filter(feed__pk=1).count(), 10)
+
+class BitbucketFeedTest(FeedTest):
+    fixtures = FeedTest.fixtures + ["bitbucket.json"]
+
+    #TODO: test fails. feedparser broken
+    def test_bitbucket_atom(self):
         update_feeds()
         self.assertEqual(Item.objects.filter(feed__pk=1).count(), 15)
 
-    def test_ianlewis_feed(self):
+    def test_bitbucket_rss(self):
         update_feeds()
-        self.assertEqual(Item.objects.filter(feed__pk=2).count(), 10)
+        self.assertEqual(Item.objects.filter(feed__pk=2).count(), 15)
 
-class AtomFeedTest(FeedTest):
-    fixtures = FeedTest.fixtures + ["atom.json"]
+def YoutubeTest(FeedTest):
+    fixtures = FeedTest.fixtures + ["youtube.json"]
 
-    #TODO: test fails. feedparser broken
-    def test_bitbucket_atom_feed(self):
+    def test_youtube_atom(self):
         update_feeds()
-        self.assertEqual(Item.objects.filter(feed__pk=100).count(), 15)
-
-    #TODO: test fails. feedparser broken
-    def test_youtube(self):
-        update_feeds()
-        self.assertEqual(Item.objects.filter(feed__pk=101).count(), 25)
+        self.assertEqual(Item.objects.filter(feed__pk=1).count(), 25)
 
 class RegressionFeedTest(FeedTest):
     fixtures = FeedTest.fixtures + ["regressions.json"]