This file is indexed.

/usr/share/pyshared/djapian/tests/common.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import os

from djapian import Field
from djapian.tests.utils import BaseTestCase, BaseIndexerTest, Entry, Person
from djapian.models import Change
from django.utils.encoding import force_unicode

class IndexerTest(BaseTestCase):
    def test_fields_count(self):
        self.assertEqual(len(Entry.indexer.fields), 1)

    def test_tags_count(self):
        self.assertEqual(len(Entry.indexer.tags), 8)

class FieldResolverTest(BaseTestCase):
    def setUp(self):
        person = Person.objects.create(name="Alex", age=22)
        another_person = Person.objects.create(name="Sam", age=25)

        self.entry = Entry.objects.create(author=person, title="Test entry")
        self.entry.editors.add(person, another_person)

    def test_simple_attribute(self):
        self.assertEqual(Field("title").resolve(self.entry), "Test entry")

    def test_related_attribute(self):
        self.assertEqual(Field("author.name").resolve(self.entry), "Alex")

    def test_fk_attribute(self):
        self.assertEqual(force_unicode(Field("author").resolve(self.entry)), "Alex")

    def test_m2m_attribute(self):
        self.assertEqual(force_unicode(Field("editors").resolve(self.entry)), "Alex, Sam")

    def test_m2m_field_attribute(self):
        self.assertEqual(force_unicode(Field("editors.age").resolve(self.entry)), "22, 25")

    def test_method(self):
        self.assertEqual(
            Field("headline").resolve(self.entry),
            "Alex - Test entry"
        )

class ChangeTrackingTest(BaseTestCase):
    def setUp(self):
        p = Person.objects.create(name="Alex")
        Entry.objects.create(author=p, title="Test entry")
        Entry.objects.create(
            author=p,
            title="Another test entry",
            is_active=False
        )

    def test_change_count(self):
        self.assertEqual(Change.objects.count(), 2)

class ChangeTrackingUpdateTest(BaseTestCase):
    def setUp(self):
        p = Person.objects.create(name="Alex")
        entry = Entry.objects.create(author=p, title="Test entry")

        entry.text = "Foobar text"
        entry.save()

    def test_change_count(self):
        self.assertEqual(Change.objects.count(), 1)

    def test_change_action(self):
        self.assertEqual(Change.objects.get().action, "add")

class ChangeTrackingDeleteTest(BaseTestCase):
    def setUp(self):
        p = Person.objects.create(name="Alex")
        entry = Entry.objects.create(author=p, title="Test entry")
        entry.delete()

    def test_change_count(self):
        self.assertEqual(Change.objects.count(), 0)