/usr/lib/python2.7/dist-packages/ubuntu-sso-client/ubuntu_sso/main/tests/test_darwin.py is in python-ubuntu-sso-client.tests 13.10-0ubuntu11.
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 | # -*- 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/>.
"""Darwin specific tests for the main module."""
import os
from dirspec import basedir
from twisted.internet import defer
from ubuntu_sso.main import darwin
from ubuntu_sso.tests import TestCase
# because we are using twisted we have java like names C0103
# pylint: disable=C0103
class DarwinTestCase(TestCase):
"""Tests for module level misc functions"""
def test_get_sso_pb_port(self):
"""Test the get_sso_pb_port function, by patching os.getuid"""
expected = os.path.join(basedir.xdg_cache_home, 'sso', 'ipc')
self.assertEqual(darwin.get_sso_domain_socket(), expected)
class DescriptionFactoryTestcase(TestCase):
"""Test the factory."""
@defer.inlineCallbacks
def setUp(self):
"""Set the tests."""
yield super(DescriptionFactoryTestcase, self).setUp()
self.domain = '/path/to/domain'
self.patch(darwin, 'get_sso_domain_socket', lambda: self.domain)
def test_server_description(self):
"""Test getting the description info."""
expected = darwin.DescriptionFactory.server_description_pattern % \
self.domain
factory = darwin.DescriptionFactory()
self.assertEqual(expected, factory.server)
def test_client_description(self):
"""Test getting the description info."""
expected = darwin.DescriptionFactory.client_description_pattern % \
self.domain
factory = darwin.DescriptionFactory()
self.assertEqual(expected, factory.client)
|