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:
Lars Kiesow 2014-07-20 22:55:25 +02:00
parent 858abbf79b
commit ff1f40a6cd
No known key found for this signature in database
GPG key ID: 5DAFE8D9C823CE73
3 changed files with 31 additions and 27 deletions

View file

@ -42,3 +42,8 @@ doc-latexpdf:
publish: sdist
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

View file

@ -3,7 +3,7 @@
"""
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
@ -75,8 +75,3 @@ class TestSequenceFunctions(unittest.TestCase):
assert len(fg.entry()) == 1
fg.remove_entry(fe)
assert len(fg.entry()) == 0

View file

@ -3,7 +3,8 @@
"""
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
@ -48,7 +49,8 @@ class TestSequenceFunctions(unittest.TestCase):
self.cloudProtocol = 'SOAP 1.1'
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.docs = 'http://www.rssboard.org/rss-specification'
self.managingEditor = 'mail@example.com'
@ -73,9 +75,12 @@ class TestSequenceFunctions(unittest.TestCase):
fg.subtitle(self.subtitle)
fg.link( href=self.link2Href, rel=self.link2Rel )
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.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.copyright(self.copyright)
fg.docs(docs=self.docs)
@ -83,7 +88,9 @@ class TestSequenceFunctions(unittest.TestCase):
fg.rating(self.rating)
fg.skipDays(self.skipDays)
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.webMaster(self.webMaster)
@ -116,7 +123,7 @@ class TestSequenceFunctions(unittest.TestCase):
fg.atom_file(filename=filename, pretty=True)
with open (filename, "r") as myfile:
atomString=myfile.read().replace('\n', '')
atomString=myfile.read().replace('\n', '')
self.checkAtomString(atomString)
@ -131,7 +138,6 @@ class TestSequenceFunctions(unittest.TestCase):
feed = etree.fromstring(atomString)
print (atomString)
nsAtom = self.nsAtom
assert feed.find("{%s}title" % nsAtom).text == self.title
@ -159,7 +165,7 @@ class TestSequenceFunctions(unittest.TestCase):
fg.rss_file(filename=filename, pretty=True)
with open (filename, "r") as myfile:
rssString=myfile.read().replace('\n', '')
rssString=myfile.read().replace('\n', '')
self.checkRssString(rssString)
@ -182,8 +188,6 @@ class TestSequenceFunctions(unittest.TestCase):
nsAtom = self.nsAtom
nsRss = self.nsRss
print (rssString)
channel = feed.find("channel")
assert channel != None
@ -217,4 +221,4 @@ class TestSequenceFunctions(unittest.TestCase):
assert channel.find("webMaster").text == self.webMaster
if __name__ == '__main__':
unittest.main()
unittest.main()