Merge lp:~dobey/ubuntu-sso-client/update-3-0 into lp:ubuntu-sso-client/stable-3-0

Proposed by dobey
Status: Merged
Approved by: dobey
Approved revision: 840
Merged at revision: 840
Proposed branch: lp:~dobey/ubuntu-sso-client/update-3-0
Merge into: lp:ubuntu-sso-client/stable-3-0
Diff against target: 204 lines (+93/-8)
8 files modified
ubuntu_sso/gtk/gui.py (+18/-0)
ubuntu_sso/gtk/tests/test_gui.py (+7/-0)
ubuntu_sso/main/linux.py (+6/-1)
ubuntu_sso/main/tests/test_linux.py (+59/-0)
ubuntu_sso/qt/current_user_sign_in_page.py (+1/-3)
ubuntu_sso/qt/setup_account_page.py (+0/-1)
ubuntu_sso/qt/tests/test_current_user_sign_in_page.py (+1/-1)
ubuntu_sso/qt/tests/test_setup_account.py (+1/-2)
To merge this branch: bzr merge lp:~dobey/ubuntu-sso-client/update-3-0
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Brian Curtin (community) Approve
Review via email: mp+110177@code.launchpad.net

Commit message

[Rodney Dawes]

    Ensure we are using strict ssl with the system ca-certificates.crt file
    Trap DBusException when getting the SessionBus, and add a test case for it

[Roberto Alsina]

    Remove back buttons in signin/signup pages (Fixes LP:1009107).

To post a comment you must log in.
Revision history for this message
Brian Curtin (brian.curtin) :
review: Approve
Revision history for this message
Roberto Alsina (ralsina) :
review: Approve
Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :

The attempt to merge lp:~dobey/ubuntu-sso-client/update-3-0 into lp:ubuntu-sso-client/stable-3-0 failed. Below is the output from the failed tests.

Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (155.1 KiB)

The attempt to merge lp:~dobey/ubuntu-sso-client/update-3-0 into lp:ubuntu-sso-client/stable-3-0 failed. Below is the output from the failed tests.

*** Running GTK test suite for ubuntu_sso ***
ubuntu_sso.utils.tests.test_parse_args
  ParseArgsTestCase
    test_parse_args_app_name_is_required ... [OK]
    test_parse_args_defaults ... [OK]
    test_parse_args_help_text ... [OK]
    test_parse_args_login_only ... [OK]
    test_parse_args_ping_url ... [OK]
    test_parse_args_policy_url ... [OK]
    test_parse_args_tc_url ... [OK]
    test_parse_args_window_id ... [OK]
twisted.trial.unittest
  TestCase
    runTest ... [OK]
ubuntu_sso.utils.tests.test_tcpactivation
  ActivationClientTestCase
    test_do_get_active_port_not_running ... [OK]
    test_do_get_active_port_running ... [OK]
    test_get_active_port_waits_classwide ... [OK]
    test_initialization ... [OK]
    test_spawn_server ... [OK]
    test_wait_server_active ... [OK]
    test_wait_server_timeouts ... [OK]
  ActivationConfigTestCase
    test_initialization ... [OK]
  ActivationDetectorTestCase
    test_initialization ... [OK]
    test_is_already_running ... [OK]
    test_is_not_already_running ... [OK]
  ActivationInstanceTestCase
    test_get_port ... [OK]
    test_get_port_fails_if_service_already_started ... [OK]
    test_initialization ... [OK]
  AsyncSleepTestCase
    test_async_sleep_fired_at_the_right_time ... [OK]
    test_async_sleep_not_fired_immediately ... [OK]
    test_async_sleep_not_fired_in_a_bit ... [OK]
  NullProtocolTestCase
    test_drops_connection ... [OK]
  PortDetectFactoryTestCase
    test_connection_failed ... [OK]
    test_connection_failed_then_lost ... [OK]
    test_connection_lost ... [OK]
    test_connection_works_then_lost ... [OK]
    test_is_listening ... [OK]
twisted.trial.unittest
  TestCase
    runTest ... [OK]
ubuntu_sso.u...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu_sso/gtk/gui.py'
2--- ubuntu_sso/gtk/gui.py 2012-04-11 16:49:02 +0000
3+++ ubuntu_sso/gtk/gui.py 2012-06-13 21:37:18 +0000
4@@ -109,6 +109,12 @@
5 LARGE_MARKUP = u'<span size="x-large">%s</span>'
6
7
8+# SSL properties and certs location
9+STRICT_SSL_PROP = 'ssl-strict'
10+CERTS_FILE_PROP = 'ssl-ca-file'
11+CA_CERT_FILE = '/etc/ssl/certs/ca-certificates.crt'
12+
13+
14 def log_call(f):
15 """Decorator to log call funtions."""
16
17@@ -953,11 +959,23 @@
18
19 self._set_current_page(self.processing_vbox)
20
21+ def _webkit_init_ssl(self):
22+ """Set the WebKit ssl strictness."""
23+ # delay the import of webkit to be able to build without it
24+ from gi.repository import WebKit # pylint: disable=E0611
25+
26+ # Set the Soup session to be strict and use system CA certs
27+ session = WebKit.get_default_session()
28+ session.set_property(STRICT_SSL_PROP, True)
29+ session.set_property(CERTS_FILE_PROP, CA_CERT_FILE)
30+
31 def _add_webkit_browser(self):
32 """Add the webkit browser for the t&c."""
33 # delay the import of webkit to be able to build without it
34 from gi.repository import WebKit # pylint: disable=E0611
35
36+ self._webkit_init_ssl()
37+
38 browser = WebKit.WebView()
39
40 browser.connect('notify::load-status',
41
42=== modified file 'ubuntu_sso/gtk/tests/test_gui.py'
43--- ubuntu_sso/gtk/tests/test_gui.py 2012-04-11 16:49:02 +0000
44+++ ubuntu_sso/gtk/tests/test_gui.py 2012-06-13 21:37:18 +0000
45@@ -911,6 +911,7 @@
46 def setUp(self):
47 yield super(TermsAndConditionsBrowserTestCase, self).setUp()
48 self.patch(WebKit, 'WebView', FakedEmbeddedBrowser)
49+ self.patch(self.ui, '_webkit_init_ssl', self._set_called)
50
51 self.ui.tc_button.clicked()
52 self.addCleanup(self.ui.tc_browser_vbox.hide)
53@@ -919,6 +920,12 @@
54 assert len(children) == 1
55 self.browser = children[0]
56
57+ def test_ssl_validation(self):
58+ """The browser is set to validate SSL."""
59+ self.assertEqual(self._called, ((), {}),
60+ '_webkit_init_ssl should be called when creating a '
61+ 'webkit browser.')
62+
63 def test_tc_browser_is_created_when_tc_page_is_shown(self):
64 """The browser is created when the TC button is clicked."""
65 self.ui.on_tc_browser_notify_load_status(self.browser)
66
67=== modified file 'ubuntu_sso/main/linux.py'
68--- ubuntu_sso/main/linux.py 2012-04-10 17:57:42 +0000
69+++ ubuntu_sso/main/linux.py 2012-06-13 21:37:18 +0000
70@@ -342,10 +342,15 @@
71
72 def __init__(self, root):
73 self.root = root
74- self.bus = dbus.SessionBus()
75 self.sso_login = None
76 self.cred_manager = None
77
78+ try:
79+ self.bus = dbus.SessionBus()
80+ except dbus.service.DBusException as e:
81+ logger.exception(e)
82+ shutdown_func()
83+
84 def start(self):
85 """Start listening, nothing async to be done in this platform."""
86 # Register DBus service for making sure we run only one instance
87
88=== added file 'ubuntu_sso/main/tests/test_linux.py'
89--- ubuntu_sso/main/tests/test_linux.py 1970-01-01 00:00:00 +0000
90+++ ubuntu_sso/main/tests/test_linux.py 2012-06-13 21:37:18 +0000
91@@ -0,0 +1,59 @@
92+# -*- coding: utf-8 -*-
93+#
94+# Copyright 2012 Canonical Ltd.
95+#
96+# This program is free software: you can redistribute it and/or modify it
97+# under the terms of the GNU General Public License version 3, as published
98+# by the Free Software Foundation.
99+#
100+# This program is distributed in the hope that it will be useful, but
101+# WITHOUT ANY WARRANTY; without even the implied warranties of
102+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
103+# PURPOSE. See the GNU General Public License for more details.
104+#
105+# You should have received a copy of the GNU General Public License along
106+# with this program. If not, see <http://www.gnu.org/licenses/>.
107+#
108+# In addition, as a special exception, the copyright holders give
109+# permission to link the code of portions of this program with the
110+# OpenSSL library under certain conditions as described in each
111+# individual source file, and distribute linked combinations
112+# including the two.
113+# You must obey the GNU General Public License in all respects
114+# for all of the code used other than OpenSSL. If you modify
115+# file(s) with this exception, you may extend this exception to your
116+# version of the file(s), but you are not obligated to do so. If you
117+# do not wish to do so, delete this exception statement from your
118+# version. If you delete this exception statement from all source
119+# files in the program, then also delete it here.
120+"""Tests for the main SSO Linux client code."""
121+
122+# pylint: disable=C0103
123+do_tests = False
124+try:
125+ import dbus
126+ import dbus.service
127+ from ubuntu_sso.main import linux as main
128+ do_tests = True
129+except ImportError:
130+ do_tests = False
131+# pylint enable=C0103
132+
133+from ubuntuone.devtools.testcases import BaseTestCase, skipIf
134+
135+
136+@skipIf(do_tests != True, 'Tests only work with DBus and linux imports.')
137+class LinuxProxyTestCase(BaseTestCase):
138+ """Test some Linux specific cases."""
139+
140+ def test_dbus_missing_exists_clean(self):
141+ """Test that dbus-daemon not being available gives us a clean exit."""
142+ def patched(*args, **kwargs):
143+ """Method to patch in for testing."""
144+ raise dbus.service.DBusException(
145+ 'org.freedesktop.DBus.Error.NoServer')
146+
147+ self.patch(dbus, "SessionBus", patched)
148+ self.patch(main, "shutdown_func", patched)
149+ self.assertRaises(dbus.service.DBusException,
150+ main.UbuntuSSOProxy, None)
151
152=== modified file 'ubuntu_sso/qt/current_user_sign_in_page.py'
153--- ubuntu_sso/qt/current_user_sign_in_page.py 2012-04-09 17:38:24 +0000
154+++ ubuntu_sso/qt/current_user_sign_in_page.py 2012-06-13 21:37:18 +0000
155@@ -97,9 +97,7 @@
156 self.setButtonText(QtGui.QWizard.CancelButton, CANCEL_BUTTON)
157 # Layout without custom button 1,
158 # without finish button
159- self.wizard().setButtonLayout([
160- QtGui.QWizard.BackButton,
161- QtGui.QWizard.Stretch])
162+ self.wizard().setButtonLayout([])
163
164 # Set sign_in_button as default when the page is shown.
165 self.ui.sign_in_button.setDefault(True)
166
167=== modified file 'ubuntu_sso/qt/setup_account_page.py'
168--- ubuntu_sso/qt/setup_account_page.py 2012-04-09 17:38:24 +0000
169+++ ubuntu_sso/qt/setup_account_page.py 2012-06-13 21:37:18 +0000
170@@ -154,7 +154,6 @@
171
172 # Button setup
173 self.wizard().setButtonLayout([
174- QtGui.QWizard.BackButton,
175 QtGui.QWizard.Stretch,
176 QtGui.QWizard.CustomButton3])
177
178
179=== modified file 'ubuntu_sso/qt/tests/test_current_user_sign_in_page.py'
180--- ubuntu_sso/qt/tests/test_current_user_sign_in_page.py 2012-04-09 17:38:24 +0000
181+++ ubuntu_sso/qt/tests/test_current_user_sign_in_page.py 2012-06-13 21:37:18 +0000
182@@ -59,7 +59,7 @@
183 self.assertEqual(wizard.buttons_text[QtGui.QWizard.CancelButton],
184 "Cancel")
185 self.assertIn(('setButtonLayout',
186- (([QtGui.QWizard.BackButton, QtGui.QWizard.Stretch],), {})),
187+ (([],), {})),
188 wizard.called)
189 self.assertTrue(button.properties['default'])
190 self.assertFalse(button.isEnabled())
191
192=== modified file 'ubuntu_sso/qt/tests/test_setup_account.py'
193--- ubuntu_sso/qt/tests/test_setup_account.py 2012-04-09 17:38:24 +0000
194+++ ubuntu_sso/qt/tests/test_setup_account.py 2012-06-13 21:37:18 +0000
195@@ -207,8 +207,7 @@
196 self.ui.initializePage()
197
198 # set up account button
199- expected = [QtGui.QWizard.BackButton, QtGui.QWizard.Stretch,
200- QtGui.QWizard.CustomButton3]
201+ expected = [QtGui.QWizard.Stretch, QtGui.QWizard.CustomButton3]
202 self.assertIn(('setButtonLayout', ((expected,), {})),
203 self.ui.wizard().called)
204 self.assertEqual(gui.SET_UP_ACCOUNT_BUTTON,

Subscribers

People subscribed via source and target branches

to all changes: