diff 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
line wrap: on
line diff
--- a/test/db_test_base.py	Mon Jan 23 04:58:21 2006 +0000
+++ b/test/db_test_base.py	Mon Jan 23 05:24:33 2006 +0000
@@ -15,9 +15,9 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 #
-# $Id: db_test_base.py,v 1.62 2006-01-13 01:18:07 richard Exp $
+# $Id: db_test_base.py,v 1.63 2006-01-23 05:24:33 richard Exp $
 
-import unittest, os, shutil, errno, imp, sys, time, pprint
+import unittest, os, shutil, errno, imp, sys, time, pprint, sets
 
 from roundup.hyperdb import String, Password, Link, Multilink, Date, \
     Interval, DatabaseError, Boolean, Number, Node
@@ -398,18 +398,36 @@
         self.db.issue.create(title="spam", status='1')
         b = self.db.status.get('1', 'name')
         a = self.db.status.list()
+        nodeids = self.db.status.getnodeids()
         self.db.status.retire('1')
+        others = nodeids[:]
+        others.remove('1')
+
+        self.assertEqual(sets.Set(self.db.status.getnodeids()),
+            sets.Set(nodeids))
+        self.assertEqual(sets.Set(self.db.status.getnodeids(retired=True)),
+            sets.Set(['1']))
+        self.assertEqual(sets.Set(self.db.status.getnodeids(retired=False)),
+            sets.Set(others))
+
+        self.assert_(self.db.status.is_retired('1'))
+
         # make sure the list is different
         self.assertNotEqual(a, self.db.status.list())
+
         # can still access the node if necessary
         self.assertEqual(self.db.status.get('1', 'name'), b)
         self.assertRaises(IndexError, self.db.status.set, '1', name='hello')
         self.db.commit()
+        self.assert_(self.db.status.is_retired('1'))
         self.assertEqual(self.db.status.get('1', 'name'), b)
         self.assertNotEqual(a, self.db.status.list())
+
         # try to restore retired node
         self.db.status.restore('1')
 
+        self.assert_(not self.db.status.is_retired('1'))
+
     def testCacheCreateSet(self):
         self.db.issue.create(title="spam", status='1')
         a = self.db.issue.get('1', 'title')

Roundup Issue Tracker: http://roundup-tracker.org/