1515# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717#
18- # $Id: test_db.py,v 1.64 2003-01-12 00:43:43 richard Exp $
18+ # $Id: test_db.py,v 1.65 2003-01-12 23:53:20 richard Exp $
1919
2020import unittest , os , shutil , time
2121
@@ -570,6 +570,10 @@ def filteringSetup(self):
570570 self .db .commit ()
571571 return self .assertEqual , self .db .issue .filter
572572
573+ def testFilteringID (self ):
574+ ae , filt = self .filteringSetup ()
575+ ae (filt (None , {'id' : '1' }, ('+' ,'id' ), (None ,None )), ['1' ])
576+
573577 def testFilteringString (self ):
574578 ae , filt = self .filteringSetup ()
575579 ae (filt (None , {'title' : 'issue one' }, ('+' ,'id' ), (None ,None )), ['1' ])
@@ -698,6 +702,32 @@ def setUp(self):
698702 setupSchema (self .db , 0 , gadfly )
699703
700704
705+ class mysqlDBTestCase (anydbmDBTestCase ):
706+ def setUp (self ):
707+ from roundup .backends import mysql
708+ # remove previous test, ignore errors
709+ if os .path .exists (config .DATABASE ):
710+ shutil .rmtree (config .DATABASE )
711+ config .MYSQL_DATABASE = 'mysql@localhost root rootpasswd' .split ()
712+ os .makedirs (config .DATABASE + '/files' )
713+ self .db = mysql .Database (config , 'admin' )
714+ setupSchema (self .db , 1 , mysql )
715+
716+ class mysqlReadOnlyDBTestCase (anydbmReadOnlyDBTestCase ):
717+ def setUp (self ):
718+ from roundup .backends import mysql
719+ # remove previous test, ignore errors
720+ if os .path .exists (config .DATABASE ):
721+ shutil .rmtree (config .DATABASE )
722+ config .MYSQL_DATABASE = 'mysql@localhost root rootpasswd' .split ()
723+ os .makedirs (config .DATABASE + '/files' )
724+ db = mysql .Database (config , 'admin' )
725+ setupSchema (db , 1 , mysql )
726+ db .close ()
727+ self .db = sqlite .Database (config )
728+ setupSchema (self .db , 0 , mysql )
729+
730+
701731class sqliteDBTestCase (anydbmDBTestCase ):
702732 def setUp (self ):
703733 from roundup .backends import sqlite
@@ -708,9 +738,6 @@ def setUp(self):
708738 self .db = sqlite .Database (config , 'admin' )
709739 setupSchema (self .db , 1 , sqlite )
710740
711- def testIDGeneration (self ):
712- pass
713-
714741class sqliteReadOnlyDBTestCase (anydbmReadOnlyDBTestCase ):
715742 def setUp (self ):
716743 from roundup .backends import sqlite
@@ -791,6 +818,11 @@ def suite():
791818# return unittest.TestSuite(l)
792819
793820 from roundup import backends
821+ # if hasattr(backends, 'mysql'):
822+ # l.append(unittest.makeSuite(mysqlDBTestCase, 'test'))
823+ # l.append(unittest.makeSuite(mysqlReadOnlyDBTestCase, 'test'))
824+ # return unittest.TestSuite(l)
825+
794826 if hasattr (backends , 'gadfly' ):
795827 l .append (unittest .makeSuite (gadflyDBTestCase , 'test' ))
796828 l .append (unittest .makeSuite (gadflyReadOnlyDBTestCase , 'test' ))
0 commit comments