This file is indexed.

/usr/lib/python2.7/dist-packages/ubuntuone_credentials/__init__.py is in ubuntuone-credentials-autopilot 14.04+14.04.20140415.

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
100
101
102
103
104
105
106
107
108
109
110
111
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
#
# Copyright (C) 2013-2014 Canonical Ltd.
#
# This program 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.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

"""UbuntuOne Credentials Online-Accounts provider plugin autopilot tests."""

import os
import subprocess
import tempfile

import fixtures
from autopilot import input
from autopilot.matchers import Eventually
from testtools.matchers import Equals
from ubuntuuitoolkit import (
    base,
    emulators as toolkit_emulators,
    tests as toolkit_tests
)

from ubuntuone_credentials import fixture_setup


def _get_module_include_path():
    return _get_path_to_source_root()


def _get_path_to_source_root():
    return os.path.abspath(
        os.path.join(
            os.path.dirname(__file__), '..', '..', '..'))


class TestCaseWithQMLWrapper(base.UbuntuUIToolkitAppTestCase):

    _DESKTOP_FILE_CONTENTS = ("""[Desktop Entry]
Type=Application
Exec=Not important
Path=Not important
Name=Test app
Icon=Not important
""")

    test_qml_wrapper_file_name = None

    def setUp(self):
        super(TestCaseWithQMLWrapper, self).setUp()
        self.pointing_device = input.Pointer(self.input_device_class.create())
        self.use_qml2_import_path_for_fake_wrapper()
        self.launch_application()

    def use_fake_servers(self):
        fake_sso_and_u1_server = fixture_setup.FakeSSOAndU1ServersRunning()
        self.useFixture(fake_sso_and_u1_server)
        self.useFixture(fixtures.EnvironmentVariable(
            'SSO_AUTH_BASE_URL', newvalue=fake_sso_and_u1_server.url))
        self.useFixture(fixtures.EnvironmentVariable(
            'SSO_UONE_BASE_URL', newvalue=fake_sso_and_u1_server.url))

    def use_qml2_import_path_for_fake_wrapper(self):
        arch = subprocess.check_output(
            ["dpkg-architecture", "-qDEB_HOST_MULTIARCH"]).strip()
        system_settings_path = (
            '/usr/lib/{}/ubuntu-system-settings/private'.format(arch))
        qml_credentials_path = os.path.join(
            _get_path_to_source_root(), 'qml-credentials-service')
        self.useFixture(fixtures.EnvironmentVariable(
            'QML2_IMPORT_PATH',
            newvalue=':'.join([system_settings_path, qml_credentials_path])))

    def launch_application(self):
        qml_file_path = os.path.join(
            os.path.dirname(__file__), self.test_qml_wrapper_file_name)
        desktop_file_path = self._write_test_desktop_file()
        self.addCleanup(os.remove, desktop_file_path)
        self.app = self.launch_test_application(
            base.get_qmlscene_launch_command(),
            '-I' + _get_module_include_path(),
            qml_file_path,
            '--desktop_file_hint={0}'.format(desktop_file_path),
            emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase,
            app_type='qt')

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

    def _write_test_desktop_file(self):
        desktop_file_dir = toolkit_tests.get_local_desktop_file_directory()
        if not os.path.exists(desktop_file_dir):
            os.makedirs(desktop_file_dir)
        desktop_file = tempfile.NamedTemporaryFile(
            suffix='.desktop', dir=desktop_file_dir, delete=False)
        desktop_file.write(self._DESKTOP_FILE_CONTENTS)
        desktop_file.close()
        return desktop_file.name

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