Mercurial > p > roundup > code
comparison test/db_test_base.py @ 3486:34ada15b9936
all backends implement the retired check in getnodeids [SF#1290560]
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 23 Jan 2006 05:24:33 +0000 |
| parents | 88f0a5030404 |
| children | 7be25d75c3d5 |
comparison
equal
deleted
inserted
replaced
| 3485:8d55b5db6365 | 3486:34ada15b9936 |
|---|---|
| 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: db_test_base.py,v 1.62 2006-01-13 01:18:07 richard Exp $ | 18 # $Id: db_test_base.py,v 1.63 2006-01-23 05:24:33 richard Exp $ |
| 19 | 19 |
| 20 import unittest, os, shutil, errno, imp, sys, time, pprint | 20 import unittest, os, shutil, errno, imp, sys, time, pprint, sets |
| 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, Node | 23 Interval, DatabaseError, Boolean, Number, Node |
| 24 from roundup import date, password, init, instance, configuration | 24 from roundup import date, password, init, instance, configuration |
| 25 | 25 |
| 396 # retirement | 396 # retirement |
| 397 def testRetire(self): | 397 def testRetire(self): |
| 398 self.db.issue.create(title="spam", status='1') | 398 self.db.issue.create(title="spam", status='1') |
| 399 b = self.db.status.get('1', 'name') | 399 b = self.db.status.get('1', 'name') |
| 400 a = self.db.status.list() | 400 a = self.db.status.list() |
| 401 nodeids = self.db.status.getnodeids() | |
| 401 self.db.status.retire('1') | 402 self.db.status.retire('1') |
| 403 others = nodeids[:] | |
| 404 others.remove('1') | |
| 405 | |
| 406 self.assertEqual(sets.Set(self.db.status.getnodeids()), | |
| 407 sets.Set(nodeids)) | |
| 408 self.assertEqual(sets.Set(self.db.status.getnodeids(retired=True)), | |
| 409 sets.Set(['1'])) | |
| 410 self.assertEqual(sets.Set(self.db.status.getnodeids(retired=False)), | |
| 411 sets.Set(others)) | |
| 412 | |
| 413 self.assert_(self.db.status.is_retired('1')) | |
| 414 | |
| 402 # make sure the list is different | 415 # make sure the list is different |
| 403 self.assertNotEqual(a, self.db.status.list()) | 416 self.assertNotEqual(a, self.db.status.list()) |
| 417 | |
| 404 # can still access the node if necessary | 418 # can still access the node if necessary |
| 405 self.assertEqual(self.db.status.get('1', 'name'), b) | 419 self.assertEqual(self.db.status.get('1', 'name'), b) |
| 406 self.assertRaises(IndexError, self.db.status.set, '1', name='hello') | 420 self.assertRaises(IndexError, self.db.status.set, '1', name='hello') |
| 407 self.db.commit() | 421 self.db.commit() |
| 422 self.assert_(self.db.status.is_retired('1')) | |
| 408 self.assertEqual(self.db.status.get('1', 'name'), b) | 423 self.assertEqual(self.db.status.get('1', 'name'), b) |
| 409 self.assertNotEqual(a, self.db.status.list()) | 424 self.assertNotEqual(a, self.db.status.list()) |
| 425 | |
| 410 # try to restore retired node | 426 # try to restore retired node |
| 411 self.db.status.restore('1') | 427 self.db.status.restore('1') |
| 428 | |
| 429 self.assert_(not self.db.status.is_retired('1')) | |
| 412 | 430 |
| 413 def testCacheCreateSet(self): | 431 def testCacheCreateSet(self): |
| 414 self.db.issue.create(title="spam", status='1') | 432 self.db.issue.create(title="spam", status='1') |
| 415 a = self.db.issue.get('1', 'title') | 433 a = self.db.issue.get('1', 'title') |
| 416 self.assertEqual(a, 'spam') | 434 self.assertEqual(a, 'spam') |
