def testMakeSingleSortKeyAccessor_Component(self): """Sorting by component should create an accessor for that column.""" self.mox.StubOutWithMock(sorting, '_IndexListAccessor') component_ids = [11, 33, 22] sorting._IndexListAccessor(component_ids, 'component accessor') self.mox.ReplayAll() sorting._MakeSingleSortKeyAccessor('component', self.config, {'component': 'component accessor'}, [], {}, []) self.mox.VerifyAll()
def testMakeSingleSortKeyAccessor_Status(self): """Sorting by status should create an accessor for that column.""" self.mox.StubOutWithMock(sorting, '_IndexOrLexical') status_names = [wks.status for wks in self.config.well_known_statuses] sorting._IndexOrLexical(status_names, 'status accessor') self.mox.ReplayAll() sorting._MakeSingleSortKeyAccessor('status', self.config, {'status': 'status accessor'}, [], {}, []) self.mox.VerifyAll()
def testMakeSingleSortKeyAccessor_WithPostProcessor(self): """Sorting a built-in user column should create a user accessor.""" self.mox.StubOutWithMock(sorting, '_MakeAccessorWithPostProcessor') users_by_id = {111L: 'fake user'} sorting._MakeAccessorWithPostProcessor(users_by_id, 'mock owner accessor', 'mock postprocessor') self.mox.ReplayAll() sorting._MakeSingleSortKeyAccessor('owner', self.config, {'owner': 'mock owner accessor'}, {'owner': 'mock postprocessor'}, users_by_id, []) self.mox.VerifyAll()
def testMakeSingleSortKeyAccessor_OtherBuiltInColunms(self): """Sorting a built-in column should create an accessor for that column.""" accessor = sorting._MakeSingleSortKeyAccessor( 'buildincol', self.config, {'buildincol': 'accessor'}, [], {}, []) self.assertEqual('accessor', accessor)