/usr/share/pyshared/djapian/tests/index.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 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | import os
from datetime import datetime
from django.db import models
from djapian import Indexer, Field
from djapian.tests.utils import BaseTestCase, BaseIndexerTest, Entry, Person
class IndexerUpdateTest(BaseIndexerTest, BaseTestCase):
def test_database_exists(self):
self.assert_(os.path.exists(Entry.indexer._db._path))
def test_document_count(self):
self.assertEqual(Entry.indexer.document_count(), 3)
class IndexCommandTest(BaseTestCase):
def setUp(self):
p = Person.objects.create(name="Alex")
entry1 = Entry.objects.create(
author=p,
title="Test entry",
text="Not large text field"
)
entry2 = Entry.objects.create(
author=p,
title="Another test entry",
is_active=False
)
from django.core.management import call_command
call_command("index", daemonize=False)
def test_database(self):
self.assertEqual(Entry.indexer.document_count(), 1)
|