diff test/db_test_base.py @ 2098:18addf2a8596

Implemented proper datatypes in mysql and postgresql backends... ...(well, sqlite too, but that doesn't care). Probably should use BOOLEAN instead of INTEGER for the Boolean props. Need to fix a bizzaro MySQL error (gee, how unusual) Need to finish MySQL migration from "version 1" database schemas.
author Richard Jones <richard@users.sourceforge.net>
date Mon, 22 Mar 2004 07:45:40 +0000
parents 93f03c6714d8
children 666402433998
line wrap: on
line diff
--- a/test/db_test_base.py	Mon Mar 22 00:28:04 2004 +0000
+++ b/test/db_test_base.py	Mon Mar 22 07:45:40 2004 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: db_test_base.py,v 1.18 2004-03-19 04:47:59 richard Exp $ 
+# $Id: db_test_base.py,v 1.19 2004-03-22 07:45:40 richard Exp $ 
 
 import unittest, os, shutil, errno, imp, sys, time, pprint
 
@@ -110,14 +110,20 @@
         i.set(id1, title='asfasd')
         self.assertNotEqual(i.get(id1, 'creator'), i.get(id1, 'actor'))
 
-    #
-    # basic operations
-    #
+    # ID number controls
     def testIDGeneration(self):
         id1 = self.db.issue.create(title="spam", status='1')
         id2 = self.db.issue.create(title="eggs", status='2')
         self.assertNotEqual(id1, id2)
+    def testIDSetting(self):
+        # XXX numeric ids
+        self.db.setid('issue', 10)
+        id2 = self.db.issue.create(title="eggs", status='2')
+        self.assertEqual('11', id2)
 
+    #
+    # basic operations
+    #
     def testEmptySet(self):
         id1 = self.db.issue.create(title="spam", status='1')
         self.db.issue.set(id1)
@@ -587,24 +593,18 @@
 
         # test disabling journalling
         # ... get the last entry
-        time.sleep(1)
-        entry = self.db.getjournal('issue', '1')[-1]
-        (x, date_stamp, x, x, x) = entry
+        jlen = len(self.db.getjournal('user', '1'))
         self.db.issue.disableJournalling()
         self.db.issue.set('1', title='hello world')
         self.db.commit()
-        entry = self.db.getjournal('issue', '1')[-1]
-        (x, date_stamp2, x, x, x) = entry
         # see if the change was journalled when it shouldn't have been
-        self.assertEqual(date_stamp, date_stamp2)
-        time.sleep(1)
+        self.assertEqual(jlen,  len(self.db.getjournal('user', '1')))
+        jlen = len(self.db.getjournal('issue', '1'))
         self.db.issue.enableJournalling()
         self.db.issue.set('1', title='hello world 2')
         self.db.commit()
-        entry = self.db.getjournal('issue', '1')[-1]
-        (x, date_stamp2, x, x, x) = entry
         # see if the change was journalled
-        self.assertNotEqual(date_stamp, date_stamp2)
+        self.assertNotEqual(jlen,  len(self.db.getjournal('issue', '1')))
 
     def testJournalPreCommit(self):
         id = self.db.user.create(username="mary")

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