Mercurial > p > roundup > code
comparison test/test_db.py @ 1253:fe67477e678f
fixes from changes today
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 08 Oct 2002 07:28:34 +0000 |
| parents | 8dd4f736370b |
| children | 85d71588a1cf |
comparison
equal
deleted
inserted
replaced
| 1252:209a47ede743 | 1253:fe67477e678f |
|---|---|
| 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.58 2002-10-03 06:56:30 richard Exp $ | 18 # $Id: test_db.py,v 1.59 2002-10-08 07:28:34 richard 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 | 23 Interval, DatabaseError, Boolean, Number |
| 192 self.db.commit() | 192 self.db.commit() |
| 193 self.assertEqual(self.db.status.get('1', 'name'), b) | 193 self.assertEqual(self.db.status.get('1', 'name'), b) |
| 194 self.assertNotEqual(a, self.db.status.list()) | 194 self.assertNotEqual(a, self.db.status.list()) |
| 195 | 195 |
| 196 def testSerialisation(self): | 196 def testSerialisation(self): |
| 197 self.db.issue.create(title="spam", status='1', | 197 nid = self.db.issue.create(title="spam", status='1', |
| 198 deadline=date.Date(), foo=date.Interval('-1d')) | 198 deadline=date.Date(), foo=date.Interval('-1d')) |
| 199 self.db.commit() | 199 self.db.commit() |
| 200 assert isinstance(self.db.issue.get('1', 'deadline'), date.Date) | 200 assert isinstance(self.db.issue.get(nid, 'deadline'), date.Date) |
| 201 assert isinstance(self.db.issue.get('1', 'foo'), date.Interval) | 201 assert isinstance(self.db.issue.get(nid, 'foo'), date.Interval) |
| 202 self.db.user.create(username="fozzy", | 202 uid = self.db.user.create(username="fozzy", |
| 203 password=password.Password('t. bear')) | 203 password=password.Password('t. bear')) |
| 204 self.db.commit() | 204 self.db.commit() |
| 205 assert isinstance(self.db.user.get('1', 'password'), password.Password) | 205 assert isinstance(self.db.user.get(uid, 'password'), password.Password) |
| 206 | 206 |
| 207 def testTransactions(self): | 207 def testTransactions(self): |
| 208 # remember the number of items we started | 208 # remember the number of items we started |
| 209 num_issues = len(self.db.issue.list()) | 209 num_issues = len(self.db.issue.list()) |
| 210 num_files = self.db.numfiles() | 210 num_files = self.db.numfiles() |
