This file is indexed.

/usr/lib/telepathy-gabble-tests/twisted/vcard/refresh-contact-info.py is in telepathy-gabble-tests 0.18.4-1.

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
"""
Test ContactInfo support.
"""

from servicetest import call_async, EventPattern, assertEquals, sync_dbus
from gabbletest import exec_test, acknowledge_iq, make_result_iq
import constants as cs
import dbus


def test(q, bus, conn, stream):
    event = q.expect('stream-iq', to=None, query_ns='vcard-temp',
            query_name='vCard')

    acknowledge_iq(stream, event.stanza)

    handle = conn.RequestHandles(1, ['bob@foo.com'])[0]
    call_async(q, conn.ContactInfo, 'RefreshContactInfo', [handle])

    event = q.expect('stream-iq', to='bob@foo.com', query_ns='vcard-temp',
        query_name='vCard')
    result = make_result_iq(stream, event.stanza)
    result.firstChildElement().addElement('FN', content='Bob')
    n = result.firstChildElement().addElement('N')
    n.addElement('GIVEN', content='Bob')
    result.firstChildElement().addElement('NICKNAME',
        content=r'bob,bob1\,,bob2,bob3\,bob4')
    label = result.firstChildElement().addElement('LABEL')
    label.addElement('LINE', content='42 West Wallaby Street')
    label.addElement('LINE', content="Bishop's Stortford\n")
    label.addElement('LINE', content='Huntingdon')
    org = result.firstChildElement().addElement('ORG')
    # ORG is a sequence of decreasingly large org.units, starting
    # with the organisation name itself (but here we've moved the org name
    # to the end, to make sure that works.)
    org.addElement('ORGUNIT', content='Dept. of Examples')
    org.addElement('ORGUNIT', content='Exemplary Team')
    org.addElement('ORGNAME', content='Collabora Ltd.')
    stream.send(result)

    q.expect('dbus-signal', signal='ContactInfoChanged',
             args=[handle, [(u'fn', [], [u'Bob']),
                            (u'n', [], [u'', u'Bob', u'', u'', u'']),
                            (u'nickname', [], [r'bob,bob1\,,bob2,bob3\,bob4']),
                            # LABEL comes out as a single blob of text
                            (u'label', [], ['42 West Wallaby Street\n'
                            "Bishop's Stortford\n"
                            'Huntingdon\n']),
                            # ORG is a sequence of decreasingly large org.units, starting
                            # with the organisation
                            (u'org', [], [u'Collabora Ltd.', u'Dept. of Examples',
                            u'Exemplary Team']),
                            ]])

    # ContactInfoChanged should not be signalled again
    forbidden = [EventPattern('dbus-signal', signal='ContactInfoChanged')]
    q.forbid_events(forbidden)

    # Refresh the contact info again; gabble should contact the server again
    call_async(q, conn.ContactInfo, 'RefreshContactInfo', [handle])

    event = q.expect('stream-iq', to='bob@foo.com', query_ns='vcard-temp',
        query_name='vCard')

    sync_dbus(bus, q, conn)

    q.unforbid_events(forbidden)

if __name__ == '__main__':
    exec_test(test)