/usr/lib/python2.7/dist-packages/ubuntu-kylin-sso-client/ubuntu_kylin_sso/main/tests/windows.py is in python-ubuntu-kylin-sso-client.tests 0.1.2.5.
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 | # -*- coding: utf-8 -*-
#
# Copyright 2012 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 warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, 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/>.
"""Utility classes for testing main on windows."""
from twisted.internet import defer
from ubuntu_kylin_sso import main
from ubuntu_kylin_sso.utils.tests.test_ipc import BaseIPCTestCase
class BaseTestCase(BaseIPCTestCase):
"""The base test case with platform specific support."""
client_class = main.UbuntuSSOClient
service_class = lambda *a: main.UbuntuSSOProxy(None)
@defer.inlineCallbacks
def setUp(self):
self.sso_service = None
def service_factory(*args):
"""Returns the service class."""
self.sso_service = main.UbuntuSSOService()
return main.UbuntuSSOProxy(self.sso_service)
self.service_class = service_factory
yield super(BaseTestCase, self).setUp()
# set the proxy to be the service started by the parent test class
self.sso_service.proxy = self.service
# patch the start of the proxy since the parent setup started it
self.patch(self.sso_service.proxy, 'start',
lambda: defer.succeed(None))
# start the service which will perform all the required operations
# except the proxy start
yield self.sso_service.start()
self.sso_client = self.client
|