Mercurial > p > roundup > code
comparison test/test_db.py @ 826:6d7a45c8464a
Added reindex command to roundup-admin.
Fixed reindex on first access.
Also fixed reindexing of entries that change.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 09 Jul 2002 04:19:09 +0000 |
| parents | 0779ea9f1f18 |
| children | 3cdfa5d86cec |
comparison
equal
deleted
inserted
replaced
| 825:0779ea9f1f18 | 826:6d7a45c8464a |
|---|---|
| 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.24 2002-07-09 03:02:53 richard Exp $ | 18 # $Id: test_db.py,v 1.25 2002-07-09 04:19:09 richard Exp $ |
| 19 | 19 |
| 20 import unittest, os, shutil | 20 import unittest, os, shutil |
| 21 | 21 |
| 22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \ | 22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \ |
| 23 Interval, Class, DatabaseError | 23 Interval, Class, DatabaseError |
| 312 self.assertEquals(self.db.indexer.search(['world'], self.db.issue), {}) | 312 self.assertEquals(self.db.indexer.search(['world'], self.db.issue), {}) |
| 313 self.assertEquals(self.db.indexer.search(['frooz'], self.db.issue), | 313 self.assertEquals(self.db.indexer.search(['frooz'], self.db.issue), |
| 314 {'2': {}}) | 314 {'2': {}}) |
| 315 self.assertEquals(self.db.indexer.search(['flebble'], self.db.issue), | 315 self.assertEquals(self.db.indexer.search(['flebble'], self.db.issue), |
| 316 {'2': {}, '1': {}}) | 316 {'2': {}, '1': {}}) |
| 317 self.assertEquals(self.db.indexer.search(['blah'], self.db.issue), | 317 |
| 318 {'1': {'files': ['2']}}) | 318 def testReindexing(self): |
| 319 self.db.issue.create(title="frooz") | |
| 320 self.db.commit() | |
| 321 self.assertEquals(self.db.indexer.search(['frooz'], self.db.issue), | |
| 322 {'1': {}}) | |
| 323 self.db.issue.set('1', title="dooble") | |
| 324 self.db.commit() | |
| 325 self.assertEquals(self.db.indexer.search(['dooble'], self.db.issue), | |
| 326 {'1': {}}) | |
| 327 self.assertEquals(self.db.indexer.search(['frooz'], self.db.issue), {}) | |
| 328 | |
| 329 def testForcedReindexing(self): | |
| 330 self.db.issue.create(title="flebble frooz") | |
| 331 self.db.commit() | |
| 332 self.assertEquals(self.db.indexer.search(['flebble'], self.db.issue), | |
| 333 {'1': {}}) | |
| 334 self.db.indexer.quiet = 1 | |
| 335 self.db.indexer.force_reindex() | |
| 336 self.db.post_init() | |
| 337 self.db.indexer.quiet = 9 | |
| 338 self.assertEquals(self.db.indexer.search(['flebble'], self.db.issue), | |
| 339 {'1': {}}) | |
| 319 | 340 |
| 320 class anydbmReadOnlyDBTestCase(MyTestCase): | 341 class anydbmReadOnlyDBTestCase(MyTestCase): |
| 321 def setUp(self): | 342 def setUp(self): |
| 322 from roundup.backends import anydbm | 343 from roundup.backends import anydbm |
| 323 # remove previous test, ignore errors | 344 # remove previous test, ignore errors |
| 417 | 438 |
| 418 return unittest.TestSuite(l) | 439 return unittest.TestSuite(l) |
| 419 | 440 |
| 420 # | 441 # |
| 421 # $Log: not supported by cvs2svn $ | 442 # $Log: not supported by cvs2svn $ |
| 443 # Revision 1.24 2002/07/09 03:02:53 richard | |
| 444 # More indexer work: | |
| 445 # - all String properties may now be indexed too. Currently there's a bit of | |
| 446 # "issue" specific code in the actual searching which needs to be | |
| 447 # addressed. In a nutshell: | |
| 448 # + pass 'indexme="yes"' as a String() property initialisation arg, eg: | |
| 449 # file = FileClass(db, "file", name=String(), type=String(), | |
| 450 # comment=String(indexme="yes")) | |
| 451 # + the comment will then be indexed and be searchable, with the results | |
| 452 # related back to the issue that the file is linked to | |
| 453 # - as a result of this work, the FileClass has a default MIME type that may | |
| 454 # be overridden in a subclass, or by the use of a "type" property as is | |
| 455 # done in the default templates. | |
| 456 # - the regeneration of the indexes (if necessary) is done once the schema is | |
| 457 # set up in the dbinit. | |
| 458 # | |
| 422 # Revision 1.23 2002/06/20 23:51:48 richard | 459 # Revision 1.23 2002/06/20 23:51:48 richard |
| 423 # Cleaned up the hyperdb tests | 460 # Cleaned up the hyperdb tests |
| 424 # | 461 # |
| 425 # Revision 1.22 2002/05/21 05:52:11 richard | 462 # Revision 1.22 2002/05/21 05:52:11 richard |
| 426 # Well whadya know, bsddb3 works again. | 463 # Well whadya know, bsddb3 works again. |
