From a9f561bff92b8bf16ad0c02505f0719d44793833 Mon Sep 17 00:00:00 2001 From: Lars Kiesow Date: Sun, 4 Sep 2016 17:49:07 +0200 Subject: [PATCH] Added unit tests for Itunes extension Signed-off-by: Lars Kiesow --- tests/test_entry.py | 2 +- tests/test_extension.py | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/tests/test_entry.py b/tests/test_entry.py index 14ef25d..a2055f2 100644 --- a/tests/test_entry.py +++ b/tests/test_entry.py @@ -92,7 +92,7 @@ class TestSequenceFunctions(unittest.TestCase): result = fg.rss_str() assert b'domain="http://www.somedomain.com/category"' in result - + def test_content_cdata_type(self): fg = FeedGenerator() fg.title('some title') diff --git a/tests/test_extension.py b/tests/test_extension.py index 0c1762c..7443f5a 100644 --- a/tests/test_extension.py +++ b/tests/test_extension.py @@ -48,3 +48,27 @@ class TestExtensionSyndication(unittest.TestCase): 'sy':'http://purl.org/rss/1.0/modules/syndication/' }) assert a[0].text == base + + +class TestExtensionPodcast(unittest.TestCase): + + def setUp(self): + self.fg = FeedGenerator() + self.fg.load_extension('podcast') + self.fg.title('title') + self.fg.link(href='http://example.com', rel='self') + self.fg.description('description') + + def test_category(self): + self.fg.podcast.itunes_category('Technology', 'Podcasting') + self.fg.podcast.itunes_explicit('no') + self.fg.podcast.itunes_complete('no') + self.fg.podcast.itunes_new_feed_url('http://example.com/new-feed.rss') + self.fg.podcast.itunes_owner('John Doe', 'john@example.com') + ns = {'itunes':'http://www.itunes.com/dtds/podcast-1.0.dtd'} + root = etree.fromstring(self.fg.rss_str()) + cat = root.xpath('/rss/channel/itunes:category/@text', namespaces=ns) + scat = root.xpath('/rss/channel/itunes:category/itunes:category/@text', + namespaces=ns) + assert cat[0] == 'Technology' + assert scat[0] == 'Podcasting'