summaryrefslogtreecommitdiff
path: root/tests/syndication_tests/feeds.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/syndication_tests/feeds.py')
-rw-r--r--tests/syndication_tests/feeds.py50
1 files changed, 48 insertions, 2 deletions
diff --git a/tests/syndication_tests/feeds.py b/tests/syndication_tests/feeds.py
index 6408838b68..ce938b8356 100644
--- a/tests/syndication_tests/feeds.py
+++ b/tests/syndication_tests/feeds.py
@@ -88,8 +88,29 @@ class ArticlesFeed(TestRss2Feed):
return Article.objects.all()
-class TestEnclosureFeed(TestRss2Feed):
- pass
+class TestSingleEnclosureRSSFeed(TestRss2Feed):
+ """
+ A feed to test that RSS feeds work with a single enclosure.
+ """
+ def item_enclosure_url(self, item):
+ return 'http://example.com'
+
+ def item_enclosure_size(self, item):
+ return 0
+
+ def item_mime_type(self, item):
+ return 'image/png'
+
+
+class TestMultipleEnclosureRSSFeed(TestRss2Feed):
+ """
+ A feed to test that RSS feeds raise an exception with multiple enclosures.
+ """
+ def item_enclosures(self, item):
+ return [
+ feedgenerator.Enclosure('http://example.com/hello.png', 0, 'image/png'),
+ feedgenerator.Enclosure('http://example.com/goodbye.png', 0, 'image/png'),
+ ]
class TemplateFeed(TestRss2Feed):
@@ -165,3 +186,28 @@ class MyCustomAtom1Feed(feedgenerator.Atom1Feed):
class TestCustomFeed(TestAtomFeed):
feed_type = MyCustomAtom1Feed
+
+
+class TestSingleEnclosureAtomFeed(TestAtomFeed):
+ """
+ A feed to test that Atom feeds work with a single enclosure.
+ """
+ def item_enclosure_url(self, item):
+ return 'http://example.com'
+
+ def item_enclosure_size(self, item):
+ return 0
+
+ def item_mime_type(self, item):
+ return 'image/png'
+
+
+class TestMultipleEnclosureAtomFeed(TestAtomFeed):
+ """
+ A feed to test that Atom feeds work with multiple enclosures.
+ """
+ def item_enclosures(self, item):
+ return [
+ feedgenerator.Enclosure('http://example.com/hello.png', 0, 'image/png'),
+ feedgenerator.Enclosure('http://example.com/goodbye.png', 0, 'image/png'),
+ ]