diff --git a/openlp/database/test/testBibleManager.py b/openlp/database/test/testBibleManager.py index 091f4e30b..0822f476f 100644 --- a/openlp/database/test/testBibleManager.py +++ b/openlp/database/test/testBibleManager.py @@ -1,3 +1,6 @@ +import random +import unittest + import os, os.path import sys mypath=os.path.split(os.path.abspath(__file__))[0] @@ -5,18 +8,32 @@ sys.path.insert(0,(os.path.join(mypath, '..', '..','..'))) from openlp.database.BibleManager import * -bm = BibleManager() -print bm -print bm.getBibles() -b = bm.getBibles() -for b1 in b: - print b1 -print bm.getBibleBooks("NIV") -c = bm.getBibleBooks("NIV") -for c1 in c: - print c1 -print bm.getBookVerseCount("NIV", "GEN", 1) -print bm.getVerseText("NIV", "GEN",1,1,1) -c = bm.getVerseText("NIV","GEN",1,2,1) -for c1 in c: - print c1 +class TestBibleManager(unittest.TestCase): + + def setUp(self): + self.bm = BibleManager() + + def testGetBibles(self): + # make sure the shuffled sequence does not lose any elements + b = self.bm.getBibles() + for b1 in b: + print b1 + self.assert_(b1 in b) + + def testGetBooks(self): + c = self.bm.getBibleBooks("NIV") + for c1 in c: + print c1 + self.assert_(c1 in c) + + def testGetBooks(self): + self.failUnless(self.bm.getBookVerseCount("NIV", "GEN", 1) == 28, "Wrong Book Count") + + def testGetVerseText(self): + c = self.bm.getVerseText("NIV","GEN",1,2,1) + for c1 in c: + print c1 + self.assert_(c1 in c) + +if __name__ == '__main__': + unittest.main()