Added more tests
Signed-off-by: Lars Kiesow <lkiesow@uos.de>
This commit is contained in:
parent
4314475bfb
commit
4c763dc832
3 changed files with 45 additions and 0 deletions
|
@ -40,6 +40,21 @@ class TestSequenceFunctions(unittest.TestCase):
|
|||
|
||||
self.fg = fg
|
||||
|
||||
def test_setEntries(self):
|
||||
fg2 = FeedGenerator()
|
||||
fg2.entry(self.fg.entry())
|
||||
assert len(fg2.entry()) == 3
|
||||
assert self.fg.entry() == fg2.entry()
|
||||
|
||||
def test_loadExtension(self):
|
||||
fe = self.fg.add_item()
|
||||
fe.id('1')
|
||||
fe.title(u'…')
|
||||
fe.content(u'…')
|
||||
fe.load_extension('base')
|
||||
assert fe.base
|
||||
assert self.fg.atom_str()
|
||||
|
||||
def test_checkEntryNumbers(self):
|
||||
fg = self.fg
|
||||
assert len(fg.entry()) == 3
|
||||
|
|
|
@ -82,6 +82,29 @@ class TestExtensionPodcast(unittest.TestCase):
|
|||
assert cat[0] == 'Technology'
|
||||
assert scat[0] == 'Podcasting'
|
||||
|
||||
def test_podcastItems(self):
|
||||
fg = self.fg
|
||||
fg.podcast.itunes_author('Lars Kiesow')
|
||||
fg.podcast.itunes_block('x')
|
||||
fg.podcast.itunes_complete(False)
|
||||
fg.podcast.itunes_explicit('no')
|
||||
fg.podcast.itunes_image('x.png')
|
||||
fg.podcast.itunes_subtitle('x')
|
||||
fg.podcast.itunes_summary('x')
|
||||
assert fg.podcast.itunes_author() == 'Lars Kiesow'
|
||||
assert fg.podcast.itunes_block() == 'x'
|
||||
assert fg.podcast.itunes_complete() == 'no'
|
||||
assert fg.podcast.itunes_explicit() == 'no'
|
||||
assert fg.podcast.itunes_image() == 'x.png'
|
||||
assert fg.podcast.itunes_subtitle() == 'x'
|
||||
assert fg.podcast.itunes_summary() == 'x'
|
||||
|
||||
# Check that we have the item in the resulting XML
|
||||
ns = {'itunes': 'http://www.itunes.com/dtds/podcast-1.0.dtd'}
|
||||
root = etree.fromstring(self.fg.rss_str())
|
||||
author = root.xpath('/rss/channel/itunes:author/text()', namespaces=ns)
|
||||
assert author == ['Lars Kiesow']
|
||||
|
||||
def test_podcastEntryItems(self):
|
||||
fe = self.fg.add_item()
|
||||
fe.title('y')
|
||||
|
@ -134,3 +157,7 @@ class TestExtensionDc(unittest.TestCase):
|
|||
m = getattr(self.fg.dc, method)
|
||||
m(method)
|
||||
assert m() == [method]
|
||||
|
||||
self.fg.id('123')
|
||||
assert self.fg.atom_str()
|
||||
assert self.fg.rss_str()
|
||||
|
|
|
@ -100,6 +100,9 @@ class TestSequenceFunctions(unittest.TestCase):
|
|||
name=self.textInputName, link=self.textInputLink)
|
||||
fg.ttl(self.ttl)
|
||||
fg.webMaster(self.webMaster)
|
||||
fg.updated('2017-02-05 13:26:58+01:00')
|
||||
fg.pubDate('2017-02-05 13:26:58+01:00')
|
||||
fg.generator('python-feedgen', 'x', uri='http://github.com/lkie...')
|
||||
|
||||
self.fg = fg
|
||||
|
||||
|
|
Loading…
Reference in a new issue