comparison test/db_test_base.py @ 5318:506c7ee9a385

Add a 'retired' parameter to Class.filter .. to allow searching for retired, non-retired or all (retired and non-retired) items similar to the argument of the same name to Class.getnodeids. This is 'False' by default (finding only non-retired items for backwards compatibility) and can be set to None (for finding retired and non-retired items) or True (for finding only retired items).
author Ralf Schlatterbeck <rsc@runtux.com>
date Thu, 19 Apr 2018 20:01:43 +0200
parents c0cda00af479
children 62de601bdf6f
comparison
equal deleted inserted replaced
5317:c0cda00af479 5318:506c7ee9a385
2163 def testFilteringSortId(self): 2163 def testFilteringSortId(self):
2164 ae, filter, filter_iter = self.filteringSetupTransitiveSearch('user') 2164 ae, filter, filter_iter = self.filteringSetupTransitiveSearch('user')
2165 for filt in filter, filter_iter: 2165 for filt in filter, filter_iter:
2166 ae(filt(None, {}, ('+','id')), 2166 ae(filt(None, {}, ('+','id')),
2167 ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']) 2167 ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'])
2168
2169 def testFilteringRetiredString(self):
2170 ae, filter, filter_iter = self.filteringSetup()
2171 self.db.issue.retire('1')
2172 self.db.commit()
2173 r = { None: (['1'], ['1'], ['1'], ['1', '2', '3'], [])
2174 , True: (['1'], ['1'], ['1'], ['1'], [])
2175 , False: ([], [], [], ['2', '3'], [])
2176 }
2177 for filt in filter, filter_iter:
2178 for retire in True, False, None:
2179 ae(filt(None, {'title': ['one']}, ('+','id'),
2180 retired=retire), r[retire][0])
2181 ae(filt(None, {'title': ['issue one']}, ('+','id'),
2182 retired=retire), r[retire][1])
2183 ae(filt(None, {'title': ['issue', 'one']}, ('+','id'),
2184 retired=retire), r[retire][2])
2185 ae(filt(None, {'title': ['issue']}, ('+','id'),
2186 retired=retire), r[retire][3])
2187 ae(filt(None, {'title': ['one', 'two']}, ('+','id'),
2188 retired=retire), r[retire][4])
2168 2189
2169 # XXX add sorting tests for other types 2190 # XXX add sorting tests for other types
2170 2191
2171 # nuke and re-create db for restore 2192 # nuke and re-create db for restore
2172 def nukeAndCreate(self): 2193 def nukeAndCreate(self):

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