Fixing some small test issues
This fixes some small issues with the unit tests and adding a test case to the Makefile so that all tests can easily be invoked by running: make test Signed-off-by: Lars Kiesow <lkiesow@uos.de>
This commit is contained in:
parent
858abbf79b
commit
ff1f40a6cd
3 changed files with 31 additions and 27 deletions
5
Makefile
5
Makefile
|
@ -42,3 +42,8 @@ doc-latexpdf:
|
||||||
|
|
||||||
publish: sdist
|
publish: sdist
|
||||||
python setup.py register sdist upload
|
python setup.py register sdist upload
|
||||||
|
|
||||||
|
test:
|
||||||
|
python -m unittest feedgen.tests.test_feed
|
||||||
|
python -m unittest feedgen.tests.test_entry
|
||||||
|
python -m unittest feedgen.tests.test_extension
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"""
|
"""
|
||||||
Tests for a basic entry
|
Tests for a basic entry
|
||||||
|
|
||||||
These test cases contain test cases for a basic entry.
|
These are test cases for a basic entry.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
@ -75,8 +75,3 @@ class TestSequenceFunctions(unittest.TestCase):
|
||||||
assert len(fg.entry()) == 1
|
assert len(fg.entry()) == 1
|
||||||
fg.remove_entry(fe)
|
fg.remove_entry(fe)
|
||||||
assert len(fg.entry()) == 0
|
assert len(fg.entry()) == 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
"""
|
"""
|
||||||
Tests for a basic feed
|
Tests for a basic feed
|
||||||
|
|
||||||
These test cases contain test cases for a basic feed. A basic feed does not contain entries so far.
|
These are test cases for a basic feed.
|
||||||
|
A basic feed does not contain entries so far.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
@ -48,7 +49,8 @@ class TestSequenceFunctions(unittest.TestCase):
|
||||||
self.cloudProtocol = 'SOAP 1.1'
|
self.cloudProtocol = 'SOAP 1.1'
|
||||||
|
|
||||||
self.icon = "http://example.com/icon.png"
|
self.icon = "http://example.com/icon.png"
|
||||||
self.contributor = {'name':"Contributor Name", 'uri':"Contributor Uri", 'email': 'Contributor email'}
|
self.contributor = {'name':"Contributor Name", 'uri':"Contributor Uri",
|
||||||
|
'email': 'Contributor email'}
|
||||||
self.copyright = "The copyright notice"
|
self.copyright = "The copyright notice"
|
||||||
self.docs = 'http://www.rssboard.org/rss-specification'
|
self.docs = 'http://www.rssboard.org/rss-specification'
|
||||||
self.managingEditor = 'mail@example.com'
|
self.managingEditor = 'mail@example.com'
|
||||||
|
@ -73,9 +75,12 @@ class TestSequenceFunctions(unittest.TestCase):
|
||||||
fg.subtitle(self.subtitle)
|
fg.subtitle(self.subtitle)
|
||||||
fg.link( href=self.link2Href, rel=self.link2Rel )
|
fg.link( href=self.link2Href, rel=self.link2Rel )
|
||||||
fg.language(self.language)
|
fg.language(self.language)
|
||||||
fg.cloud(domain=self.cloudDomain, port=self.cloudPort, path=self.cloudPath, registerProcedure=self.cloudRegisterProcedure, protocol=self.cloudProtocol)
|
fg.cloud(domain=self.cloudDomain, port=self.cloudPort,
|
||||||
|
path=self.cloudPath, registerProcedure=self.cloudRegisterProcedure,
|
||||||
|
protocol=self.cloudProtocol)
|
||||||
fg.icon(self.icon)
|
fg.icon(self.icon)
|
||||||
fg.category(term=self.categoryTerm, scheme=self.categoryScheme, label=self.categoryLabel)
|
fg.category(term=self.categoryTerm, scheme=self.categoryScheme,
|
||||||
|
label=self.categoryLabel)
|
||||||
fg.contributor(self.contributor)
|
fg.contributor(self.contributor)
|
||||||
fg.copyright(self.copyright)
|
fg.copyright(self.copyright)
|
||||||
fg.docs(docs=self.docs)
|
fg.docs(docs=self.docs)
|
||||||
|
@ -83,7 +88,9 @@ class TestSequenceFunctions(unittest.TestCase):
|
||||||
fg.rating(self.rating)
|
fg.rating(self.rating)
|
||||||
fg.skipDays(self.skipDays)
|
fg.skipDays(self.skipDays)
|
||||||
fg.skipHours(self.skipHours)
|
fg.skipHours(self.skipHours)
|
||||||
fg.textInput(title=self.textInputTitle, description=self.textInputDescription, name=self.textInputName, link=self.textInputLink)
|
fg.textInput(title=self.textInputTitle,
|
||||||
|
description=self.textInputDescription, name=self.textInputName,
|
||||||
|
link=self.textInputLink)
|
||||||
fg.ttl(self.ttl)
|
fg.ttl(self.ttl)
|
||||||
fg.webMaster(self.webMaster)
|
fg.webMaster(self.webMaster)
|
||||||
|
|
||||||
|
@ -116,7 +123,7 @@ class TestSequenceFunctions(unittest.TestCase):
|
||||||
fg.atom_file(filename=filename, pretty=True)
|
fg.atom_file(filename=filename, pretty=True)
|
||||||
|
|
||||||
with open (filename, "r") as myfile:
|
with open (filename, "r") as myfile:
|
||||||
atomString=myfile.read().replace('\n', '')
|
atomString=myfile.read().replace('\n', '')
|
||||||
|
|
||||||
self.checkAtomString(atomString)
|
self.checkAtomString(atomString)
|
||||||
|
|
||||||
|
@ -131,7 +138,6 @@ class TestSequenceFunctions(unittest.TestCase):
|
||||||
|
|
||||||
feed = etree.fromstring(atomString)
|
feed = etree.fromstring(atomString)
|
||||||
|
|
||||||
print (atomString)
|
|
||||||
nsAtom = self.nsAtom
|
nsAtom = self.nsAtom
|
||||||
|
|
||||||
assert feed.find("{%s}title" % nsAtom).text == self.title
|
assert feed.find("{%s}title" % nsAtom).text == self.title
|
||||||
|
@ -159,7 +165,7 @@ class TestSequenceFunctions(unittest.TestCase):
|
||||||
fg.rss_file(filename=filename, pretty=True)
|
fg.rss_file(filename=filename, pretty=True)
|
||||||
|
|
||||||
with open (filename, "r") as myfile:
|
with open (filename, "r") as myfile:
|
||||||
rssString=myfile.read().replace('\n', '')
|
rssString=myfile.read().replace('\n', '')
|
||||||
|
|
||||||
self.checkRssString(rssString)
|
self.checkRssString(rssString)
|
||||||
|
|
||||||
|
@ -182,8 +188,6 @@ class TestSequenceFunctions(unittest.TestCase):
|
||||||
nsAtom = self.nsAtom
|
nsAtom = self.nsAtom
|
||||||
nsRss = self.nsRss
|
nsRss = self.nsRss
|
||||||
|
|
||||||
print (rssString)
|
|
||||||
|
|
||||||
channel = feed.find("channel")
|
channel = feed.find("channel")
|
||||||
assert channel != None
|
assert channel != None
|
||||||
|
|
||||||
|
@ -217,4 +221,4 @@ class TestSequenceFunctions(unittest.TestCase):
|
||||||
assert channel.find("webMaster").text == self.webMaster
|
assert channel.find("webMaster").text == self.webMaster
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Reference in a new issue