Mercurial > p > roundup > code
comparison test/test_db.py @ 859:eb924e614934
Fixes for the metakit backend
(removed the cut-n-paste IssueClass, removed
a special case for it in testing)
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Sun, 14 Jul 2002 02:16:29 +0000 |
| parents | 2dd862af72ee |
| children | 2df32a73eb45 |
comparison
equal
deleted
inserted
replaced
| 858:2dd862af72ee | 859:eb924e614934 |
|---|---|
| 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.27 2002-07-14 02:05:54 richard Exp $ | 18 # $Id: test_db.py,v 1.28 2002-07-14 02:16:29 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, DatabaseError | 23 Interval, DatabaseError |
| 455 # a rollback... | 455 # a rollback... |
| 456 self.assertNotEqual(num_files, num_files2) | 456 self.assertNotEqual(num_files, num_files2) |
| 457 self.db.file.create(name="test", type="text/plain", content="hi") | 457 self.db.file.create(name="test", type="text/plain", content="hi") |
| 458 self.db.rollback() | 458 self.db.rollback() |
| 459 | 459 |
| 460 def testNewProperty(self): | |
| 461 ' make sure a new property is added ok ' | |
| 462 self.db.issue.create(title="spam", status='1') | |
| 463 self.db.issue.addprop(fixer=Link("user")) | |
| 464 props = self.db.issue.getprops() | |
| 465 keys = props.keys() | |
| 466 keys.sort() | |
| 467 # metakit _base_ Class has the activity, creation and creator too | |
| 468 self.assertEqual(keys, ['activity', 'creation', 'creator', | |
| 469 'deadline', 'files', 'fixer', 'foo', 'id', 'nosy', 'status', | |
| 470 'title']) | |
| 471 self.assertEqual(self.db.issue.get('1', "fixer"), None) | |
| 472 | |
| 473 class metakitReadOnlyDBTestCase(anydbmReadOnlyDBTestCase): | 460 class metakitReadOnlyDBTestCase(anydbmReadOnlyDBTestCase): |
| 474 def setUp(self): | 461 def setUp(self): |
| 475 from roundup.backends import metakit | 462 from roundup.backends import metakit |
| 476 import weakref | 463 import weakref |
| 477 metakit._instances = weakref.WeakValueDictionary() | 464 metakit._instances = weakref.WeakValueDictionary() |
| 515 | 502 |
| 516 return unittest.TestSuite(l) | 503 return unittest.TestSuite(l) |
| 517 | 504 |
| 518 # | 505 # |
| 519 # $Log: not supported by cvs2svn $ | 506 # $Log: not supported by cvs2svn $ |
| 507 # Revision 1.27 2002/07/14 02:05:54 richard | |
| 508 # . all storage-specific code (ie. backend) is now implemented by the backends | |
| 509 # | |
| 520 # Revision 1.26 2002/07/11 01:11:03 richard | 510 # Revision 1.26 2002/07/11 01:11:03 richard |
| 521 # Added metakit backend to the db tests and fixed the more easily fixable test | 511 # Added metakit backend to the db tests and fixed the more easily fixable test |
| 522 # failures. | 512 # failures. |
| 523 # | 513 # |
| 524 # Revision 1.25 2002/07/09 04:19:09 richard | 514 # Revision 1.25 2002/07/09 04:19:09 richard |
