summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dcfcaa9)
raw | patch | inline | side by side (parent: dcfcaa9)
author | kedder <kedder@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Mon, 10 Mar 2003 18:16:42 +0000 (18:16 +0000) | ||
committer | kedder <kedder@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Mon, 10 Mar 2003 18:16:42 +0000 (18:16 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1582 57a73879-2fb5-44c3-a270-3262357dd7e2
test/test_db.py | patch | blob | history |
diff --git a/test/test_db.py b/test/test_db.py
index a8f35c207ca7a150980353345576ddc38311f9b8..43ed8b18970c7f60dd6d0aa5c1dd0d1fa3fec316 100644 (file)
--- a/test/test_db.py
+++ b/test/test_db.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: test_db.py,v 1.75 2003-03-10 00:22:21 richard Exp $
+# $Id: test_db.py,v 1.76 2003-03-10 18:16:42 kedder Exp $
import unittest, os, shutil, time
iss = self.db.issue
for issue in (
{'title': 'issue one', 'status': '2',
- 'foo': date.Interval('1:10')},
+ 'foo': date.Interval('1:10'),
+ 'deadline': date.Date('2003-01-01.00:00')},
{'title': 'issue two', 'status': '1',
- 'foo': date.Interval('1d')},
+ 'foo': date.Interval('1d'),
+ 'deadline': date.Date('2003-02-16.22:50')},
{'title': 'issue three', 'status': '1',
- 'nosy': ['1','2']}):
+ 'nosy': ['1','2'], 'deadline': date.Date('2003-03-08')}):
self.db.issue.create(**issue)
self.db.commit()
return self.assertEqual, self.db.issue.filter
ae(filt(None, {'nosy': '2', 'status': '1'}, ('+','id'), (None,None)),
['3'])
+ def testFilteringRange(self):
+ ae, filt = self.filteringSetup()
+ ae(filt(None, {'deadline': 'from 2003-02-10 to 2003-02-23'}), ['2'])
+ ae(filt(None, {'deadline': '2003-02-10; 2003-02-23'}), ['2'])
+ ae(filt(None, {'deadline': '; 2003-02-16'}), ['1'])
+ # Lets assume people won't invent a time machine, otherwise this test
+ # may fail :)
+ ae(filt(None, {'deadline': 'from 2003-02-16'}), ['2', '3'])
+ ae(filt(None, {'deadline': '2003-02-16'}), ['2', '3'])
+
def testFilteringIntervalSort(self):
ae, filt = self.filteringSetup()
# ascending should sort None, 1:10, 1d
# descending should sort 1d, 1:10, None
ae(filt(None, {}, ('-','foo'), (None,None)), ['2', '1', '3'])
-
# XXX add sorting tests for other types
# XXX test auditors and reactors
from roundup import backends
p = []
-# if hasattr(backends, 'mysql'):
-# from roundup.backends import mysql
-# try:
-# # Check if we can run mysql tests
-# import MySQLdb
-# db = mysql.Database(nodbconfig, 'admin')
-# db.conn.select_db(config.MYSQL_DBNAME)
-# db.sql("SHOW TABLES");
-# tables = db.sql_fetchall()
-# if tables:
-# # Database should be empty. We don't dare to delete any data
-# raise DatabaseError, "(Database %s contains tables)" % config.MYSQL_DBNAME
-# db.sql("DROP DATABASE %s" % config.MYSQL_DBNAME)
-# db.sql("CREATE DATABASE %s" % config.MYSQL_DBNAME)
-# db.close()
-# except (MySQLdb.ProgrammingError, DatabaseError), msg:
-# print "Warning! Mysql tests will not be performed", msg
-# print "See doc/mysql.txt for more details."
-# else:
-# p.append('mysql')
-# l.append(unittest.makeSuite(mysqlDBTestCase, 'test'))
-# l.append(unittest.makeSuite(mysqlReadOnlyDBTestCase, 'test'))
+ if hasattr(backends, 'mysql'):
+ from roundup.backends import mysql
+ try:
+ # Check if we can run mysql tests
+ import MySQLdb
+ db = mysql.Database(nodbconfig, 'admin')
+ db.conn.select_db(config.MYSQL_DBNAME)
+ db.sql("SHOW TABLES");
+ tables = db.sql_fetchall()
+ if tables:
+ # Database should be empty. We don't dare to delete any data
+ raise DatabaseError, "(Database %s contains tables)" % config.MYSQL_DBNAME
+ db.sql("DROP DATABASE %s" % config.MYSQL_DBNAME)
+ db.sql("CREATE DATABASE %s" % config.MYSQL_DBNAME)
+ db.close()
+ except (MySQLdb.ProgrammingError, DatabaseError), msg:
+ print "Warning! Mysql tests will not be performed", msg
+ print "See doc/mysql.txt for more details."
+ else:
+ p.append('mysql')
+ l.append(unittest.makeSuite(mysqlDBTestCase, 'test'))
+ l.append(unittest.makeSuite(mysqlReadOnlyDBTestCase, 'test'))
#return unittest.TestSuite(l)
if hasattr(backends, 'gadfly'):