def test_filtering_unverified_only(self): event_filter = EventFilter() event_filter.unverified_only = True filter_expression_builder = EventFilterExpressionBuilder() filter_expression = filter_expression_builder.create_filter_expression( event_filter) event = self.dao.get_first(filter_expression) self.assertEqual(event.id, 1961050101) event = self.dao.get_last(filter_expression) self.assertEqual(event.id, 1961050101)
def test_filtering_latest_date(self): event_filter = EventFilter() event_filter.latest_date = AlexDate(1960, 1, 30) filter_expression_builder = EventFilterExpressionBuilder() filter_expression = filter_expression_builder.create_filter_expression( event_filter) event = self.dao.get_first(filter_expression) self.assertEqual(event.id, 1940000001) event = self.dao.get_last(filter_expression) self.assertEqual(event.id, 1960013001)
def test_filtering_II(self): event_filter = EventFilter() event_filter.searchterms = ["doesn't find anything"] filter_expression_builder = EventFilterExpressionBuilder() filter_expression = filter_expression_builder.create_filter_expression( event_filter) event = self.dao.get_first(filter_expression) self.assertEqual(event, None) event = self.dao.get_last(filter_expression) self.assertEqual(event, None)
def test_filtering(self): event_filter = EventFilter() event_filter.searchterms = ['weit', 'ritt', 'Zwei'] filter_expression_builder = EventFilterExpressionBuilder() filter_expression = filter_expression_builder.create_filter_expression( event_filter) event = self.dao.get_first(filter_expression) self.assertEqual(event.id, 1950000001) event = self.dao.get_next(event, filter_expression) self.assertEqual(event.id, 1960013001) event = self.dao.get_next(event, filter_expression) self.assertEqual(event.id, 1950000001) event = self.dao.get_previous(event, filter_expression) self.assertEqual(event.id, 1960013001) event = self.dao.get_last(filter_expression) self.assertEqual(event.id, 1960013001)
def setUp(self): super().setUp() erfasser_dao = CreatorDao(self.engine) document_type_dao = DocumentTypeDao(self.engine) self.references_dao = DocumentEventRelationsDao( self.engine, DocumentFilterExpressionBuilder(), EventFilterExpressionBuilder()) ereignistyp_dao = EventTypeDao(self.engine) creator_provider = BasicCreatorProvider(erfasser_dao) self.dao = EventDao(self.engine, erfasser_dao, self.references_dao, ereignistyp_dao, creator_provider) self.dokument_dao = DocumentDao(self.engine, None, erfasser_dao, creator_provider, document_type_dao)
def setUp(self): super().setUp() self.dao = DocumentEventRelationsDao(self.engine, DocumentFilterExpressionBuilder(), EventFilterExpressionBuilder())