This file is indexed.

/usr/lib/python3/dist-packages/messaging_app/tests/__init__.py is in messaging-app-autopilot 0.1+16.04.20160323-0ubuntu1.

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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright 2012-2014 Canonical
#
# This file is part of messaging-app.
#
# messaging-app is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.

"""Messaging App autopilot tests."""

from autopilot.input import Mouse, Touch, Pointer
from autopilot.matchers import Eventually
from autopilot.platform import model
from autopilot.testcase import AutopilotTestCase
from testtools.matchers import Equals

from ubuntuuitoolkit import emulators as toolkit_emulators
from messaging_app import emulators, helpers

import os
import logging
import subprocess

logger = logging.getLogger(__name__)

# ensure we have an ofono account; we assume that we have these tools,
# otherwise we consider this a test failure (missing dependencies)
helpers.ensure_ofono_account()


class MessagingAppTestCase(AutopilotTestCase):
    """A common test case class that provides several useful methods for
    Messaging App tests.

    """

    # Don't use keyboard on desktop
    if model() == 'Desktop':
        try:
            subprocess.call(['/sbin/initctl', 'stop', 'maliit-server'])
        except:
            pass

    if model() == 'Desktop':
        scenarios = [
            ('with mouse', dict(input_device_class=Mouse)),
        ]
    else:
        scenarios = [
            ('with touch', dict(input_device_class=Touch)),
        ]

    local_location = '../../src/messaging-app'

    def setUp(self, parameter=""):
        self.pointing_device = Pointer(self.input_device_class.create())
        super(MessagingAppTestCase, self).setUp()

        subprocess.call(['pkill', 'messaging-app'])

        if os.path.exists(self.local_location):
            self.launch_test_local(parameter)
        else:
            self.launch_test_installed(parameter)

        self.assertThat(self.main_view.visible, Eventually(Equals(True)))

    def launch_test_local(self, parameter):
        self.app = self.launch_test_application(
            self.local_location,
            parameter,
            app_type='qt',
            emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)

    def launch_test_installed(self, parameter):
        if model() == 'Desktop':
            self.app = self.launch_test_application(
                'messaging-app',
                parameter,
                emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)
        else:
            self.app = self.launch_upstart_application(
                'messaging-app',
                parameter,
                emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)

    @property
    def main_view(self):
        return self.app.select_single(emulators.MainView)

    def verify_thread(self, phone_num, message):
        """Check that the thread with given number and message exists"""
        # verify our number
        mess_thread = self.main_view.get_thread_from_number(phone_num)
        self.assertThat(mess_thread.phoneNumber, Equals(phone_num))
        # verify our text
        self.assertThat(mess_thread.textMessage, Equals(message))
        return mess_thread