Skip to content

Commit 193422f

Browse files
committed
Added more test cases for the filter_by_search method
1 parent 83183aa commit 193422f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

datatables_listview/tests/test_views.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def test_filter_by_search_text(self):
105105
Test for the 'filter_by_search_text' method of the view
106106
"""
107107
self.view.model = TestPerson
108-
self.view.fields = ['name', 'birth_date', 'gender', 'id']
108+
self.view.fields = ['name', 'birth_date', 'gender', 'id', 'dog']
109109
tested_method = self.view.filter_by_search_text
110110
# Normal case searching for a unique coincidence
111111
method_result = tested_method(self.view.get_queryset(), "Name3")
@@ -140,3 +140,9 @@ def test_filter_by_search_text(self):
140140
# icontains choices display test
141141
method_result = tested_method(self.view.get_queryset(), "FeMa")
142142
self.assertTrue(method_result.exists())
143+
144+
# Multiple words search test
145+
method_result = tested_method(self.view.get_queryset(), "Search with multiple words")
146+
self.assertFalse(method_result.exists())
147+
method_result = tested_method(self.view.get_queryset(), "Search with found coincidence insensitive case aMe1")
148+
self.assertEqual(method_result.count(), 2)

0 commit comments

Comments
 (0)