Skip to content

Commit 471951b

Browse files
author
Ralf Schlatterbeck
committed
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...
1 parent 52a2130 commit 471951b

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

test/db_test_base.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: db_test_base.py,v 1.72 2006-07-13 13:30:39 schlatterbeck Exp $
18+
# $Id: db_test_base.py,v 1.73 2006-08-17 09:32:46 schlatterbeck Exp $
1919

2020
import unittest, os, shutil, errno, imp, sys, time, pprint, sets
2121

@@ -928,6 +928,8 @@ def filteringSetup(self):
928928
{'username': 'blorp', 'age': 2}):
929929
self.db.user.create(**user)
930930
iss = self.db.issue
931+
file_content = ''.join([chr(i) for i in range(255)])
932+
f = self.db.file.create(content=file_content)
931933
for issue in (
932934
{'title': 'issue one', 'status': '2', 'assignedto': '1',
933935
'foo': date.Interval('1:10'), 'priority': '3',
@@ -939,10 +941,9 @@ def filteringSetup(self):
939941
'nosy': ['1','2'], 'deadline': date.Date('2003-02-18')},
940942
{'title': 'non four', 'status': '3',
941943
'foo': date.Interval('0:10'), 'priority': '2',
942-
'nosy': ['1'], 'deadline': date.Date('2004-03-08')}):
944+
'nosy': ['1'], 'deadline': date.Date('2004-03-08'),
945+
'files': [f]}):
943946
self.db.issue.create(**issue)
944-
file_content = ''.join([chr(i) for i in range(255)])
945-
self.db.file.create(content=file_content)
946947
self.db.commit()
947948
return self.assertEqual, self.db.issue.filter
948949

@@ -984,6 +985,14 @@ def testFilteringLink(self):
984985
ae(filt(None, {'assignedto': ['1', None]}, ('+','id'), (None,None)),
985986
['1', '3','4'])
986987

988+
def testFilteringMultilinkAndGroup(self):
989+
"""testFilteringMultilinkAndGroup:
990+
See roundup Bug 1541128: apparently grouping by something and
991+
searching a Multilink failed with MySQL 5.0
992+
"""
993+
ae, filt = self.filteringSetup()
994+
ae(filt(None, {'files': '1'}, ('-','activity'), ('+','status')), ['4'])
995+
987996
def testFilteringRetired(self):
988997
ae, filt = self.filteringSetup()
989998
self.db.issue.retire('2')
@@ -1057,6 +1066,15 @@ def testFilteringMultilinkSort(self):
10571066
ae(filt(None, {}, ('+','nosy'), (None,None)), ['1', '2', '4', '3'])
10581067
ae(filt(None, {}, ('-','nosy'), (None,None)), ['3', '4', '1', '2'])
10591068

1069+
def testFilteringMultilinkSortGroup(self):
1070+
# 1: status: 2 "in-progress" nosy: []
1071+
# 2: status: 1 "unread" nosy: []
1072+
# 3: status: 1 "unread" nosy: ['1','2']
1073+
# 4: status: 3 "testing" nosy: ['1']
1074+
ae, filt = self.filteringSetup()
1075+
ae(filt(None, {}, ('+','nosy'), ('+','status')), ['1', '4', '2', '3'])
1076+
ae(filt(None, {}, ('-','nosy'), ('+','status')), ['1', '4', '3', '2'])
1077+
10601078
def testFilteringLinkSortGroup(self):
10611079
# 1: status: 2, priority: 3
10621080
# 2: status: 1, priority: 3

0 commit comments

Comments
 (0)