Mercurial > p > roundup > code
diff test/test_db.py @ 1170:af104fa52746
Added some words to the installation doc about choosing backends.
Added hyperdb Class.filter unit tests - gadfly currently fails
substring searching, but I knew it would :(
Lots of fixes to the RDBMS backend - it works a treat now!
A couple of other cleanups in CGI land...
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 19 Sep 2002 02:37:41 +0000 |
| parents | 94620e088e3a |
| children | 8e318dfaf479 |
line wrap: on
line diff
--- a/test/test_db.py Wed Sep 18 22:26:07 2002 +0000 +++ b/test/test_db.py Thu Sep 19 02:37:41 2002 +0000 @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: test_db.py,v 1.49 2002-09-18 07:04:39 richard Exp $ +# $Id: test_db.py,v 1.50 2002-09-19 02:37:41 richard Exp $ import unittest, os, shutil, time @@ -476,6 +476,40 @@ self.assertEquals(self.db.indexer.search(['flebble'], self.db.issue), {'1': {}}) + def filteringSetup(self): + for user in ( + {'username': 'bleep'}, + {'username': 'blop'}, + {'username': 'blorp'}): + self.db.user.create(**user) + iss = self.db.issue + for issue in ( + {'title': 'issue one', 'status': '2'}, + {'title': 'issue two', 'status': '1'}, + {'title': 'issue three', 'status': '1', 'nosy': ['1','2']}): + self.db.issue.create(**issue) + self.db.commit() + return self.assertEqual, self.db.issue.filter + + def testFilteringString(self): + ae, filt = self.filteringSetup() + ae(filt(None, {'title': 'issue one'}, ('+','id'), (None,None)), ['1']) + ae(filt(None, {'title': 'issue'}, ('+','id'), (None,None)), + ['1','2','3']) + + def testFilteringLink(self): + ae, filt = self.filteringSetup() + ae(filt(None, {'status': '1'}, ('+','id'), (None,None)), ['2','3']) + + def testFilteringMultilink(self): + ae, filt = self.filteringSetup() + ae(filt(None, {'nosy': '2'}, ('+','id'), (None,None)), ['3']) + + def testFilteringMany(self): + ae, filt = self.filteringSetup() + ae(filt(None, {'nosy': '2', 'status': '1'}, ('+','id'), (None,None)), + ['3']) + class anydbmReadOnlyDBTestCase(MyTestCase): def setUp(self): from roundup.backends import anydbm @@ -678,7 +712,21 @@ unittest.makeSuite(anydbmDBTestCase, 'test'), unittest.makeSuite(anydbmReadOnlyDBTestCase, 'test') ] -# return unittest.TestSuite(l) + #return unittest.TestSuite(l) + + try: + import sqlite + l.append(unittest.makeSuite(sqliteDBTestCase, 'test')) + l.append(unittest.makeSuite(sqliteReadOnlyDBTestCase, 'test')) + except: + print 'sqlite module not found, skipping gadfly DBTestCase' + + try: + import gadfly + l.append(unittest.makeSuite(gadflyDBTestCase, 'test')) + l.append(unittest.makeSuite(gadflyReadOnlyDBTestCase, 'test')) + except: + print 'gadfly module not found, skipping gadfly DBTestCase' try: import bsddb @@ -695,20 +743,6 @@ print 'bsddb3 module not found, skipping bsddb3 DBTestCase' try: - import gadfly - l.append(unittest.makeSuite(gadflyDBTestCase, 'test')) - l.append(unittest.makeSuite(gadflyReadOnlyDBTestCase, 'test')) - except: - print 'gadfly module not found, skipping gadfly DBTestCase' - - try: - import sqlite - l.append(unittest.makeSuite(sqliteDBTestCase, 'test')) - l.append(unittest.makeSuite(sqliteReadOnlyDBTestCase, 'test')) - except: - print 'sqlite module not found, skipping gadfly DBTestCase' - - try: import metakit l.append(unittest.makeSuite(metakitDBTestCase, 'test')) l.append(unittest.makeSuite(metakitReadOnlyDBTestCase, 'test'))
