Ejemplo n.º 1
0
 def test_filtering_7(self):
     document_filter = DocumentFilter()
     document_filter.searchterms = ["äöüß"]
     document_filter.case_sensitive = False
     filter_expression = self.document_filter_handler.create_filter_expression(
         document_filter)
     document = self.dao.get_first(filter_expression)
     self.assertEqual(document.id, 13)
Ejemplo n.º 2
0
 def testSignatureFiltering(self):
     document_filter = DocumentFilter()
     document_filter.signature = "1.1"
     filter_expression = self.document_filter_handler.create_filter_expression(
         document_filter)
     document = self.dao.get_last(filter_expression)
     self.assertEqual(4, document.id)
     document = self.dao.get_next(document, filter_expression)
     self.assertEqual(1, document.id)
Ejemplo n.º 3
0
 def test_filtering_6(self):
     document_filter = DocumentFilter()
     document_filter.missing_event_link = True
     filter_expression = self.document_filter_handler.create_filter_expression(
         document_filter)
     document = self.dao.get_first(filter_expression)
     for doc_id in (8, 11, 12, 13, 14, 8):
         self.assertEqual(document.id, doc_id)
         document = self.dao.get_next(document, filter_expression)
Ejemplo n.º 4
0
 def testCombinedFiltering(self):
     document_filter = DocumentFilter()
     document_filter.signature = "1.1"
     document_filter.searchterms = ["rstes"]
     filter_expression = self.document_filter_handler.create_filter_expression(
         document_filter)
     document = self.dao.get_last(filter_expression)
     self.assertEqual(1, document.id)
     document = self.dao.get_next(document, filter_expression)
     self.assertEqual(1, document.id)
Ejemplo n.º 5
0
    def testDocumentTypeFiltering(self):

        document_filter = DocumentFilter()
        document_filter.document_type = 13
        filter_expression = self.document_filter_handler.create_filter_expression(
            document_filter)
        document = self.dao.get_last(filter_expression)
        self.assertEqual(12, document.id)
        document = self.dao.get_next(document, filter_expression)
        self.assertEqual(11, document.id)
Ejemplo n.º 6
0
 def test_filtering_3(self):
     document_filter = DocumentFilter()
     # Erster Term: 'Erstes', 'Drittes' 'Viertes'
     # Zweiter Term: 'Zweites', 'Drittes', 'Viertes'
     # Schnittmenge: 'Drittes', 'Viertes'
     document_filter.searchterms = ["r", "i"]
     document_filter.combine_searchterms_by_or = False
     filter_expression = self.document_filter_handler.create_filter_expression(
         document_filter)
     documents = self.dao.find(filter_expression)
     self.assertEqual(2, len(documents))
Ejemplo n.º 7
0
 def testFileTypeFiltering(self):
     document_filter = DocumentFilter()
     document_filter.filetype = "txt"
     filter_expression = self.document_filter_handler.create_filter_expression(
         document_filter)
     document = self.dao.get_first(filter_expression)
     self.assertEqual(4, document.id)
     document = self.dao.get_next(document, filter_expression)
     self.assertEqual(11, document.id)
     document = self.dao.get_next(document, filter_expression)
     self.assertEqual(12, document.id)
     document = self.dao.get_next(document, filter_expression)
     self.assertEqual(4, document.id)
Ejemplo n.º 8
0
 def test_filtering_1(self):
     document_filter = DocumentFilter()
     document_filter.searchterms = ["weit"]
     filter_expression = self.document_filter_handler.create_filter_expression(
         document_filter)
     document = self.dao.get_first(filter_expression)
     self.assertEqual(document.id, 4)
     document = self.dao.get_next(document, filter_expression)
     self.assertEqual(document.id, 4)
     document = self.dao.get_previous(document, filter_expression)
     self.assertEqual(document.id, 4)
     document = self.dao.get_last(filter_expression)
     self.assertEqual(document.id, 4)
    def testToggleFilterIII(self):
        self.view.filter_object = DocumentFilter()

        self.document_window_presenter.update_filter_expression()

        self.assertEqual(self.document_window_presenter.filter_expression,
                         None)
    def testToggleFilterII(self):
        self.view.filter_object = DocumentFilter()
        self.view.filter_object.searchterms = ["Does not match any record"]

        self.document_window_presenter.update_filter_expression()
        self.document_window_presenter.goto_last()

        self.assertEqual(self.view.entity, None)
    def testToggleFilterI(self):
        self.view.filter_object = DocumentFilter()
        self.view.filter_object.searchterms = ["Erstes"]

        self.document_window_presenter.update_filter_expression()
        self.document_window_presenter.goto_last()

        self.assertEqual(self.view.entity.id, 1)
Ejemplo n.º 12
0
 def test_filtering_4(self):
     '''
     Test that repeated expression generation yields the same result
     '''
     document_filter = DocumentFilter()
     document_filter.searchterms = ["weit"]
     filter_expression1 = self.document_filter_handler.create_filter_expression(
         document_filter)
     document = self.dao.get_first(filter_expression1)
     self.assertEqual(document.id, 4)
     document_filter.searchterms = ["unsinn"]
     filter_expression2 = self.document_filter_handler.create_filter_expression(
         document_filter)
     document = self.dao.get_first(filter_expression2)
     self.assertEqual(document, None)
     document_filter.searchterms = ["weit"]
     filter_expression3 = self.document_filter_handler.create_filter_expression(
         document_filter)
     document = self.dao.get_first(filter_expression3)
     self.assertEqual(document.id, 4)
Ejemplo n.º 13
0
 def test_filtering_5(self):
     '''
     Test that case insensitive filtering works
     
     This test actually does not work because sqlite
     always searches case sensitive
     '''
     document_filter = DocumentFilter()
     document_filter.searchterms = ["RITT", "WEIT"]
     document_filter.case_sensitive = False
     filter_expression = self.document_filter_handler.create_filter_expression(
         document_filter)
     document = self.dao.get_first(filter_expression)
     self.assertEqual(document.id, 4)
     document = self.dao.get_next(document, filter_expression)
     self.assertEqual(document.id, 8)
     document = self.dao.get_next(document, filter_expression)
     self.assertEqual(document.id, 4)
     document = self.dao.get_previous(document, filter_expression)
     self.assertEqual(document.id, 8)
     document = self.dao.get_previous(document, filter_expression)
     self.assertEqual(document.id, 4)
     document = self.dao.get_last(filter_expression)
     self.assertEqual(document.id, 8)
 def _new_filter_object(self):
     return DocumentFilter()