comparison test/test_db.py @ 860:2df32a73eb45

Implemented a switch to disable journalling for a Class. CGI session database now uses it.
author Richard Jones <richard@users.sourceforge.net>
date Sun, 14 Jul 2002 04:03:15 +0000
parents eb924e614934
children 37fb48c3a136
comparison
equal deleted inserted replaced
859:eb924e614934 860:2df32a73eb45
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.28 2002-07-14 02:16:29 richard Exp $ 18 # $Id: test_db.py,v 1.29 2002-07-14 04:03:15 richard Exp $
19 19
20 import unittest, os, shutil 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 23 Interval, DatabaseError
24 from roundup import date, password 24 from roundup import date, password
25 from roundup.indexer import Indexer 25 from roundup.indexer import Indexer
282 self.assertEqual('1', nodeid) 282 self.assertEqual('1', nodeid)
283 self.assertEqual('test', journaltag) 283 self.assertEqual('test', journaltag)
284 self.assertEqual('unlink', action) 284 self.assertEqual('unlink', action)
285 self.assertEqual(('issue', '1', 'fixer'), params) 285 self.assertEqual(('issue', '1', 'fixer'), params)
286 286
287 # test disabling journalling
288 # ... get the last entry
289 time.sleep(1)
290 entry = self.db.getjournal('issue', '1')[-1]
291 (x, date_stamp, x, x, x) = entry
292 self.db.issue.disableJournalling()
293 self.db.issue.set('1', title='hello world')
294 self.db.commit()
295 entry = self.db.getjournal('issue', '1')[-1]
296 (x, date_stamp2, x, x, x) = entry
297 # see if the change was journalled when it shouldn't have been
298 self.assertEqual(date_stamp, date_stamp2)
299 self.db.issue.enableJournalling()
300 self.db.issue.set('1', title='hello world 2')
301 self.db.commit()
302 entry = self.db.getjournal('issue', '1')[-1]
303 (x, date_stamp2, x, x, x) = entry
304 # see if the change was journalled
305 self.assertNotEqual(date_stamp, date_stamp2)
306
287 def testPack(self): 307 def testPack(self):
288 self.db.issue.create(title="spam", status='1') 308 self.db.issue.create(title="spam", status='1')
289 self.db.commit() 309 self.db.commit()
290 self.db.issue.set('1', status='2') 310 self.db.issue.set('1', status='2')
291 self.db.commit() 311 self.db.commit()
502 522
503 return unittest.TestSuite(l) 523 return unittest.TestSuite(l)
504 524
505 # 525 #
506 # $Log: not supported by cvs2svn $ 526 # $Log: not supported by cvs2svn $
527 # Revision 1.28 2002/07/14 02:16:29 richard
528 # Fixes for the metakit backend (removed the cut-n-paste IssueClass, removed
529 # a special case for it in testing)
530 #
507 # Revision 1.27 2002/07/14 02:05:54 richard 531 # Revision 1.27 2002/07/14 02:05:54 richard
508 # . all storage-specific code (ie. backend) is now implemented by the backends 532 # . all storage-specific code (ie. backend) is now implemented by the backends
509 # 533 #
510 # Revision 1.26 2002/07/11 01:11:03 richard 534 # Revision 1.26 2002/07/11 01:11:03 richard
511 # Added metakit backend to the db tests and fixed the more easily fixable test 535 # Added metakit backend to the db tests and fixed the more easily fixable test

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