/usr/share/pyshared/djapian/tests/query.py is in python-django-djapian 2.3.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | from djapian.tests.utils import BaseIndexerTest, BaseTestCase, Entry
def query_test(query, count):
class _QueryTest(BaseIndexerTest, BaseTestCase):
def setUp(self):
super(_QueryTest, self).setUp()
self.result = Entry.indexer.search(query)
def test_result_count(self):
self.assertEqual(len(self.result), count)
_QueryTest.__name__ = _QueryTest.__name__ + '_' + query.replace(" ", "_")
return _QueryTest
IndexerSearchCharFieldTest = query_test("title:test", 2)
IndexerSearchAliasFieldTest = query_test("subject:test", 2)
IndexerSearchBoolFieldTest = query_test("active:True", 3)
IndexerSearchAndQueryTest = query_test("title:test AND title:another", 1)
|