Mercurial > p > roundup > code
comparison test/db_test_base.py @ 2400:5fd066bcf9cf
tests for last fix
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 08 Jun 2004 05:35:07 +0000 |
| parents | fa2f7ba34399 |
| children | 89072e66b5f5 |
comparison
equal
deleted
inserted
replaced
| 2398:202701d52788 | 2400:5fd066bcf9cf |
|---|---|
| 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.28 2004-05-16 09:35:50 richard Exp $ | 18 # $Id: db_test_base.py,v 1.29 2004-06-08 05:35:07 richard Exp $ |
| 19 | 19 |
| 20 import unittest, os, shutil, errno, imp, sys, time, pprint | 20 import unittest, os, shutil, errno, imp, sys, time, pprint |
| 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 |
| 958 for name in klass.getprops().keys(): | 958 for name in klass.getprops().keys(): |
| 959 it[name] = klass.get(id, name) | 959 it[name] = klass.get(id, name) |
| 960 | 960 |
| 961 # grab the export | 961 # grab the export |
| 962 export = {} | 962 export = {} |
| 963 journals = {} | |
| 963 for cn,klass in self.db.classes.items(): | 964 for cn,klass in self.db.classes.items(): |
| 964 names = klass.getprops().keys() | 965 names = klass.getprops().keys() |
| 965 cl = export[cn] = [names+['is retired']] | 966 cl = export[cn] = [names+['is retired']] |
| 966 for id in klass.getnodeids(): | 967 for id in klass.getnodeids(): |
| 967 cl.append(klass.export_list(names, id)) | 968 cl.append(klass.export_list(names, id)) |
| 969 journals[cn] = klass.export_journals() | |
| 968 | 970 |
| 969 # shut down this db and nuke it | 971 # shut down this db and nuke it |
| 970 self.db.close() | 972 self.db.close() |
| 971 self.nuke_database() | 973 self.nuke_database() |
| 972 | 974 |
| 981 names = items[0] | 983 names = items[0] |
| 982 maxid = 1 | 984 maxid = 1 |
| 983 for itemprops in items[1:]: | 985 for itemprops in items[1:]: |
| 984 maxid = max(maxid, int(klass.import_list(names, itemprops))) | 986 maxid = max(maxid, int(klass.import_list(names, itemprops))) |
| 985 self.db.setid(cn, str(maxid+1)) | 987 self.db.setid(cn, str(maxid+1)) |
| 988 klass.import_journals(journals[cn]) | |
| 986 | 989 |
| 987 # compare with snapshot of the database | 990 # compare with snapshot of the database |
| 988 for cn, items in orig.items(): | 991 for cn, items in orig.items(): |
| 989 klass = self.db.classes[cn] | 992 klass = self.db.classes[cn] |
| 990 propdefs = klass.getprops(1) | 993 propdefs = klass.getprops(1) |
