diff test/db_test_base.py @ 3675:f3785d646f22

Added two new tests: - testFilteringMultilinkAndGroup tests the new bug in generated SQL with MySQL 5.0, see http://sf.net/tracker/?func=detail&atid=402788&aid=1541128&group_id=31577 It needs to be verified that it really catches the bug, I have only MySQL 4.1 installed and the test runs through. - testFilteringMultilinkSortGroup: This verifies that grouping by something *and* sorting by a multilink will destroy the grouping-order for the SQL implementation. This test fails for all the SQL backends. Reason: We first let SQL sort by all the given sort attributes except multilinks. *Then* we sort by all the multilink properties. Now if the multilink is not the first sort attribute (not used in "group") but the second (used in "sort") re-sorting will destroy the established sort-order returned by the SQL query. Note: I intend to fix this...
author Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
date Thu, 17 Aug 2006 09:32:46 +0000
parents fa7becc62534
children b9301ae1c34d
line wrap: on
line diff
--- a/test/db_test_base.py	Wed Aug 16 19:00:47 2006 +0000
+++ b/test/db_test_base.py	Thu Aug 17 09:32:46 2006 +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.72 2006-07-13 13:30:39 schlatterbeck Exp $
+# $Id: db_test_base.py,v 1.73 2006-08-17 09:32:46 schlatterbeck Exp $
 
 import unittest, os, shutil, errno, imp, sys, time, pprint, sets
 
@@ -928,6 +928,8 @@
                 {'username': 'blorp', 'age': 2}):
             self.db.user.create(**user)
         iss = self.db.issue
+        file_content = ''.join([chr(i) for i in range(255)])
+        f = self.db.file.create(content=file_content)
         for issue in (
                 {'title': 'issue one', 'status': '2', 'assignedto': '1',
                     'foo': date.Interval('1:10'), 'priority': '3',
@@ -939,10 +941,9 @@
                     'nosy': ['1','2'], 'deadline': date.Date('2003-02-18')},
                 {'title': 'non four', 'status': '3',
                     'foo': date.Interval('0:10'), 'priority': '2',
-                    'nosy': ['1'], 'deadline': date.Date('2004-03-08')}):
+                    'nosy': ['1'], 'deadline': date.Date('2004-03-08'),
+                    'files': [f]}):
             self.db.issue.create(**issue)
-        file_content = ''.join([chr(i) for i in range(255)])
-        self.db.file.create(content=file_content)
         self.db.commit()
         return self.assertEqual, self.db.issue.filter
 
@@ -984,6 +985,14 @@
         ae(filt(None, {'assignedto': ['1', None]}, ('+','id'), (None,None)),
             ['1', '3','4'])
 
+    def testFilteringMultilinkAndGroup(self):
+        """testFilteringMultilinkAndGroup:
+        See roundup Bug 1541128: apparently grouping by something and
+        searching a Multilink failed with MySQL 5.0
+        """
+        ae, filt = self.filteringSetup()
+        ae(filt(None, {'files': '1'}, ('-','activity'), ('+','status')), ['4'])
+
     def testFilteringRetired(self):
         ae, filt = self.filteringSetup()
         self.db.issue.retire('2')
@@ -1057,6 +1066,15 @@
         ae(filt(None, {}, ('+','nosy'), (None,None)), ['1', '2', '4', '3'])
         ae(filt(None, {}, ('-','nosy'), (None,None)), ['3', '4', '1', '2'])
 
+    def testFilteringMultilinkSortGroup(self):
+        # 1: status: 2 "in-progress" nosy: []
+        # 2: status: 1 "unread"      nosy: []
+        # 3: status: 1 "unread"      nosy: ['1','2']
+        # 4: status: 3 "testing"     nosy: ['1']
+        ae, filt = self.filteringSetup()
+        ae(filt(None, {}, ('+','nosy'), ('+','status')), ['1', '4', '2', '3'])
+        ae(filt(None, {}, ('-','nosy'), ('+','status')), ['1', '4', '3', '2'])
+
     def testFilteringLinkSortGroup(self):
         # 1: status: 2, priority: 3
         # 2: status: 1, priority: 3

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