Mercurial > p > roundup > code
comparison test/test_db.py @ 1523:63aa7be52d2c
checked to make sure that the restored item doesn't clash...
...with a new item using the same key value
| author | Andrey Lebedev <kedder@users.sourceforge.net> |
|---|---|
| date | Mon, 17 Mar 2003 22:03:08 +0000 |
| parents | 6fede2aa6a12 |
| children | 96cd422532ef |
comparison
equal
deleted
inserted
replaced
| 1522:d20680d611a6 | 1523:63aa7be52d2c |
|---|---|
| 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.77 2003-03-16 22:24:56 kedder Exp $ | 18 # $Id: test_db.py,v 1.78 2003-03-17 22:03:08 kedder 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, Node | 23 Interval, DatabaseError, Boolean, Number, Node |
| 271 self.assertRaises(KeyError, self.db.user.lookup, 'spam') | 271 self.assertRaises(KeyError, self.db.user.lookup, 'spam') |
| 272 | 272 |
| 273 # use the key again now that the old is retired | 273 # use the key again now that the old is retired |
| 274 newid2 = self.db.user.create(username="spam") | 274 newid2 = self.db.user.create(username="spam") |
| 275 self.assertNotEqual(newid, newid2) | 275 self.assertNotEqual(newid, newid2) |
| 276 # try to restore old node. this shouldn't succeed! | |
| 277 self.assertRaises(KeyError, self.db.user.restore, newid) | |
| 276 | 278 |
| 277 def testRetire(self): | 279 def testRetire(self): |
| 278 self.db.issue.create(title="spam", status='1') | 280 self.db.issue.create(title="spam", status='1') |
| 279 b = self.db.status.get('1', 'name') | 281 b = self.db.status.get('1', 'name') |
| 280 a = self.db.status.list() | 282 a = self.db.status.list() |
| 924 def suite(): | 926 def suite(): |
| 925 l = [ | 927 l = [ |
| 926 unittest.makeSuite(anydbmDBTestCase, 'test'), | 928 unittest.makeSuite(anydbmDBTestCase, 'test'), |
| 927 unittest.makeSuite(anydbmReadOnlyDBTestCase, 'test') | 929 unittest.makeSuite(anydbmReadOnlyDBTestCase, 'test') |
| 928 ] | 930 ] |
| 929 # return unittest.TestSuite(l) | 931 #return unittest.TestSuite(l) |
| 930 | 932 |
| 931 from roundup import backends | 933 from roundup import backends |
| 932 p = [] | 934 p = [] |
| 933 if hasattr(backends, 'mysql'): | 935 if hasattr(backends, 'mysql'): |
| 934 from roundup.backends import mysql | 936 from roundup.backends import mysql |
