Mercurial > p > roundup > code
comparison test/test_db.py @ 1198:1c5bc0e2ed7d
*** empty log message ***
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 24 Sep 2002 02:00:52 +0000 |
| parents | 08a13a84ed43 |
| children | bc3bc3248dd1 |
comparison
equal
deleted
inserted
replaced
| 1197:7d1b69122133 | 1198:1c5bc0e2ed7d |
|---|---|
| 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 17 # | 17 # |
| 18 # $Id: test_db.py,v 1.54 2002-09-23 06:48:35 richard Exp $ | 18 # $Id: test_db.py,v 1.55 2002-09-24 01:59:44 richard Exp $ |
| 19 | 19 |
| 20 import unittest, os, shutil, time | 20 import unittest, os, shutil, time |
| 21 | 21 |
| 22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \ | 22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \ |
| 23 Interval, DatabaseError, Boolean, Number | 23 Interval, DatabaseError, Boolean, Number |
| 485 self.db.post_init() | 485 self.db.post_init() |
| 486 self.db.indexer.quiet = 9 | 486 self.db.indexer.quiet = 9 |
| 487 self.assertEquals(self.db.indexer.search(['flebble'], self.db.issue), | 487 self.assertEquals(self.db.indexer.search(['flebble'], self.db.issue), |
| 488 {'1': {}}) | 488 {'1': {}}) |
| 489 | 489 |
| 490 def testStringFind(self): | |
| 491 ids = [] | |
| 492 ids.append(self.db.issue.create(title="spam")) | |
| 493 self.db.issue.create(title="not spam") | |
| 494 ids.append(self.db.issue.create(title="spam")) | |
| 495 ids.sort() | |
| 496 got = self.db.issue.stringFind(title='spam') | |
| 497 got.sort() | |
| 498 self.assertEqual(got, ids) | |
| 499 self.assertEqual(self.db.issue.stringFind(title='fubar'), []) | |
| 500 | |
| 490 def filteringSetup(self): | 501 def filteringSetup(self): |
| 491 for user in ( | 502 for user in ( |
| 492 {'username': 'bleep'}, | 503 {'username': 'bleep'}, |
| 493 {'username': 'blop'}, | 504 {'username': 'blop'}, |
| 494 {'username': 'blorp'}): | 505 {'username': 'blorp'}): |
| 717 def suite(): | 728 def suite(): |
| 718 l = [ | 729 l = [ |
| 719 unittest.makeSuite(anydbmDBTestCase, 'test'), | 730 unittest.makeSuite(anydbmDBTestCase, 'test'), |
| 720 unittest.makeSuite(anydbmReadOnlyDBTestCase, 'test') | 731 unittest.makeSuite(anydbmReadOnlyDBTestCase, 'test') |
| 721 ] | 732 ] |
| 722 return unittest.TestSuite(l) | 733 # return unittest.TestSuite(l) |
| 723 | 734 |
| 724 try: | 735 from roundup import backends |
| 725 import gadfly | 736 if hasattr(backends, 'gadfly'): |
| 726 l.append(unittest.makeSuite(gadflyDBTestCase, 'test')) | 737 l.append(unittest.makeSuite(gadflyDBTestCase, 'test')) |
| 727 l.append(unittest.makeSuite(gadflyReadOnlyDBTestCase, 'test')) | 738 l.append(unittest.makeSuite(gadflyReadOnlyDBTestCase, 'test')) |
| 728 except: | 739 |
| 729 print 'gadfly module not found, skipping gadfly DBTestCase' | 740 if hasattr(backends, 'sqlite'): |
| 730 | |
| 731 try: | |
| 732 import sqlite | |
| 733 l.append(unittest.makeSuite(sqliteDBTestCase, 'test')) | 741 l.append(unittest.makeSuite(sqliteDBTestCase, 'test')) |
| 734 l.append(unittest.makeSuite(sqliteReadOnlyDBTestCase, 'test')) | 742 l.append(unittest.makeSuite(sqliteReadOnlyDBTestCase, 'test')) |
| 735 except: | 743 |
| 736 print 'sqlite module not found, skipping gadfly DBTestCase' | 744 if hasattr(backends, 'bsddb'): |
| 737 | |
| 738 try: | |
| 739 import bsddb | |
| 740 l.append(unittest.makeSuite(bsddbDBTestCase, 'test')) | 745 l.append(unittest.makeSuite(bsddbDBTestCase, 'test')) |
| 741 l.append(unittest.makeSuite(bsddbReadOnlyDBTestCase, 'test')) | 746 l.append(unittest.makeSuite(bsddbReadOnlyDBTestCase, 'test')) |
| 742 except: | 747 |
| 743 print 'bsddb module not found, skipping bsddb DBTestCase' | 748 if hasattr(backends, 'bsddb3'): |
| 744 | |
| 745 try: | |
| 746 import bsddb3 | |
| 747 l.append(unittest.makeSuite(bsddb3DBTestCase, 'test')) | 749 l.append(unittest.makeSuite(bsddb3DBTestCase, 'test')) |
| 748 l.append(unittest.makeSuite(bsddb3ReadOnlyDBTestCase, 'test')) | 750 l.append(unittest.makeSuite(bsddb3ReadOnlyDBTestCase, 'test')) |
| 749 except: | 751 |
| 750 print 'bsddb3 module not found, skipping bsddb3 DBTestCase' | 752 if hasattr(backends, 'metakit'): |
| 751 | |
| 752 try: | |
| 753 import metakit | |
| 754 l.append(unittest.makeSuite(metakitDBTestCase, 'test')) | 753 l.append(unittest.makeSuite(metakitDBTestCase, 'test')) |
| 755 l.append(unittest.makeSuite(metakitReadOnlyDBTestCase, 'test')) | 754 l.append(unittest.makeSuite(metakitReadOnlyDBTestCase, 'test')) |
| 756 except: | |
| 757 print 'metakit module not found, skipping metakit DBTestCase' | |
| 758 | 755 |
| 759 return unittest.TestSuite(l) | 756 return unittest.TestSuite(l) |
| 760 | 757 |
| 761 # vim: set filetype=python ts=4 sw=4 et si | 758 # vim: set filetype=python ts=4 sw=4 et si |
