Added unit test cases for extension loading
Also fixed bugs regarding the upcoming feed.py fix
This commit is contained in:
parent
d2bbc87f6c
commit
da06835e8b
5 changed files with 24 additions and 10 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -6,3 +6,7 @@ venv
|
|||
feedgen/tests/tmp_Atomfeed.xml
|
||||
|
||||
feedgen/tests/tmp_Rssfeed.xml
|
||||
|
||||
tmp_Atomfeed.xml
|
||||
|
||||
tmp_Rssfeed.xml
|
||||
|
|
0
feedgen/tests/__init__.py
Normal file
0
feedgen/tests/__init__.py
Normal file
|
@ -1,15 +1,14 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Tests for a basic feed
|
||||
Tests for a basic entry
|
||||
|
||||
These test cases contain test cases for a basic feed. A basic feed does not contain entries so far.
|
||||
These test cases contain test cases for a basic entry.
|
||||
"""
|
||||
|
||||
import unittest
|
||||
from lxml import etree
|
||||
from feedgen.feed import FeedGenerator
|
||||
|
||||
from ..feed import FeedGenerator
|
||||
|
||||
class TestSequenceFunctions(unittest.TestCase):
|
||||
|
||||
|
|
0
feedgen/tests/test_extension.py
Normal file
0
feedgen/tests/test_extension.py
Normal file
|
@ -8,11 +8,12 @@ These test cases contain test cases for a basic feed. A basic feed does not cont
|
|||
|
||||
import unittest
|
||||
from lxml import etree
|
||||
from ..feed import FeedGenerator
|
||||
|
||||
class TestSequenceFunctions(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
from feedgen.feed import FeedGenerator
|
||||
|
||||
fg = FeedGenerator()
|
||||
|
||||
self.nsAtom = "http://www.w3.org/2005/Atom"
|
||||
|
@ -164,12 +165,16 @@ class TestSequenceFunctions(unittest.TestCase):
|
|||
|
||||
def test_rssFeedString(self):
|
||||
fg = self.fg
|
||||
|
||||
rssString = fg.rss_str(pretty=True)
|
||||
self.checkRssString(rssString)
|
||||
|
||||
def test_loadExtension(self):
|
||||
raise Exception('Not yet implemented')
|
||||
def test_loadPodcastExtension(self):
|
||||
fg = self.fg
|
||||
fg.load_extension('podcast', atom=True, rss=True)
|
||||
|
||||
def test_loadDcExtension(self):
|
||||
fg = self.fg
|
||||
fg.load_extension('dc', atom=True, rss=True)
|
||||
|
||||
def checkRssString(self, rssString):
|
||||
|
||||
|
@ -177,6 +182,8 @@ class TestSequenceFunctions(unittest.TestCase):
|
|||
nsAtom = self.nsAtom
|
||||
nsRss = self.nsRss
|
||||
|
||||
print (rssString)
|
||||
|
||||
channel = feed.find("channel")
|
||||
assert channel != None
|
||||
|
||||
|
@ -191,7 +198,11 @@ class TestSequenceFunctions(unittest.TestCase):
|
|||
assert channel.find("image").find("title").text == self.title
|
||||
assert channel.find("image").find("link").text == self.link2Href
|
||||
assert channel.find("category").text == self.categoryLabel
|
||||
assert channel.find("cloud").text == self.cloud
|
||||
assert channel.find("cloud").get('domain') == self.cloudDomain
|
||||
assert channel.find("cloud").get('port') == self.cloudPort
|
||||
assert channel.find("cloud").get('path') == self.cloudPath
|
||||
assert channel.find("cloud").get('registerProcedure') == self.cloudRegisterProcedure
|
||||
assert channel.find("cloud").get('protocol') == self.cloudProtocol
|
||||
assert channel.find("copyright").text == self.copyright
|
||||
assert channel.find("docs").text == self.docs
|
||||
assert channel.find("managingEditor").text == self.managingEditor
|
||||
|
@ -202,7 +213,7 @@ class TestSequenceFunctions(unittest.TestCase):
|
|||
assert channel.find("textInput").get('description') == self.textInputDescription
|
||||
assert channel.find("textInput").get('name') == self.textInputName
|
||||
assert channel.find("textInput").get('link') == self.textInputLink
|
||||
assert channel.find("ttl").text == self.ttl
|
||||
assert int(channel.find("ttl").text) == self.ttl
|
||||
assert channel.find("webMaster").text == self.webMaster
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in a new issue