Merge lp:~nataliabidart/ubuntu-sso-client/split-gui into lp:ubuntu-sso-client

Proposed by Natalia Bidart on 2010-11-19
Status: Merged
Approved by: Natalia Bidart on 2010-11-24
Approved revision: 657
Merged at revision: 653
Proposed branch: lp:~nataliabidart/ubuntu-sso-client/split-gui
Merge into: lp:ubuntu-sso-client
Diff against target: 1130 lines (+329/-227)
14 files modified
.bzrignore (+1/-0)
data/ui.glade (+148/-101)
po/POTFILES.in (+1/-1)
setup.py (+2/-3)
ubuntu_sso/credentials.py (+11/-11)
ubuntu_sso/gtk/__init__.py (+19/-0)
ubuntu_sso/gtk/gui.py (+13/-19)
ubuntu_sso/gtk/tests/__init__.py (+19/-0)
ubuntu_sso/gtk/tests/test_gui.py (+12/-13)
ubuntu_sso/main.py (+6/-3)
ubuntu_sso/tests/__init__.py (+2/-0)
ubuntu_sso/tests/bin/show_gui (+1/-1)
ubuntu_sso/tests/test_credentials.py (+89/-73)
ubuntu_sso/tests/test_main.py (+5/-2)
To merge this branch: bzr merge lp:~nataliabidart/ubuntu-sso-client/split-gui
Reviewer Review Type Date Requested Status
Vincenzo Di Somma (community) Approve on 2010-11-24
Eric Casteleijn (community) 2010-11-19 Approve on 2010-11-22
Review via email: mp+41369@code.launchpad.net

Commit Message

* Make UI more friendly to resizes and big fonts (LP: #627496).
* Splitting GUI code out of backend (LP: #677518).

Description of the Change

This branch introduces 2 main changes:

** The gtk ui has been tweaked a bit so it looks good even on small screens or with big fonts

To test this you can follow the procedure described in the bug report LP: #627496.

** All the gtk ui code is separated into a new gtk package

To accomplish the former, besides moving modules around, 2 new parameters were added to the (new since Natty) dbus methods for the CredentialsManagement interface:

* 'ui_module': string describing the import path to the module providing the UI
* 'ui_class': string describing the name of the class within 'ui_module' that opens the graphical interface to login/register

To test this new parameters you should:

* run from this branch the following:

nessita@dali:~/canonical/ubuntu-sso-client/split-gui$ killall ubuntu-sso-login; DEBUG=True PYTHONPATH=. ./bin/ubuntu-sso-login

* open d-feet and execute the 'login' or 'register' method for the CredentialsManagement interface (com.ubuntu.sso dbus service) and pass parameters like:

'Test Me', {'help_text': 'Lorem Ipsum sir Amet', 'tc_url': 'http://google.com', 'ui_module': 'test.me', 'ui_class': 'yadda'}

this would throw ImportError such as:

Traceback (most recent call last):
  File "/home/nessita/canonical/ubuntu-sso-client/split-gui/ubuntu_sso/credentials.py", line 86, in inner
    result = f(self, *a, **kw)
  File "/home/nessita/canonical/ubuntu-sso-client/split-gui/ubuntu_sso/credentials.py", line 248, in _show_ui
    __import__(self.ui_module)
ImportError: No module named me

A successful call would be achieved passing parameters like:

'Test Me', {'help_text': 'Lorem Ipsum sir Amet', 'tc_url': 'http://google.com', 'ui_module': 'ubuntu_sso.gtk.gui', 'ui_class': 'UbuntuSSOClientGUI'}

To post a comment you must log in.
Eric Casteleijn (thisfred) wrote :

"""
* open d-feet and execute the 'login' or 'register' method for the CredentialsManagement interface (com.ubuntu.sso dbus service) and pass parameters like:

'Test Me', {'help_text': 'Lorem Ipsum sir Amet', 'tc_url': 'http://google.com', 'ui_module': 'test.me', 'ui_class': 'yadda'}

this would throw ImportError such as:

...
"""

It does not, I see:

'This method did not return anything' for both login and register.

I'm probably doing it wrong™.

review: Needs Information
Eric Casteleijn (thisfred) wrote :

Strike that, was looking in the wrong place.

Eric Casteleijn (thisfred) wrote :

Yep, works like a charm! +1

review: Approve
Vincenzo Di Somma (vds) :
review: Approve
Ubuntu One Auto Pilot (otto-pilot) wrote :

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2010-06-12 17:44:39 +0000
3+++ .bzrignore 2010-11-24 12:51:04 +0000
4@@ -3,3 +3,4 @@
5 build/
6 dist/
7 MANIFEST
8+po/ubuntu-sso-client.pot
9
10=== modified file 'data/ui.glade'
11--- data/ui.glade 2010-11-02 15:27:18 +0000
12+++ data/ui.glade 2010-11-24 12:51:04 +0000
13@@ -3,14 +3,14 @@
14 <requires lib="gtk+" version="2.16"/>
15 <!-- interface-naming-policy project-wide -->
16 <object class="GtkWindow" id="window">
17- <property name="border_width">20</property>
18+ <property name="border_width">10</property>
19 <property name="resizable">False</property>
20 <property name="window_position">center</property>
21 <signal name="delete_event" handler="on_close_clicked"/>
22 <child>
23 <object class="GtkVBox" id="window_vbox">
24 <property name="visible">True</property>
25- <property name="spacing">10</property>
26+ <property name="spacing">5</property>
27 <child>
28 <object class="GtkLabel" id="header_label">
29 <property name="visible">True</property>
30@@ -20,7 +20,7 @@
31 </object>
32 <packing>
33 <property name="expand">False</property>
34- <property name="padding">10</property>
35+ <property name="padding">5</property>
36 <property name="position">0</property>
37 </packing>
38 </child>
39@@ -33,7 +33,6 @@
40 </object>
41 <packing>
42 <property name="expand">False</property>
43- <property name="padding">5</property>
44 <property name="position">1</property>
45 </packing>
46 </child>
47@@ -46,7 +45,6 @@
48 </object>
49 <packing>
50 <property name="expand">False</property>
51- <property name="padding">5</property>
52 <property name="position">2</property>
53 </packing>
54 </child>
55@@ -58,7 +56,7 @@
56 </object>
57 <object class="GtkVBox" id="enter_details_vbox">
58 <property name="visible">True</property>
59- <property name="spacing">10</property>
60+ <property name="spacing">5</property>
61 <child>
62 <object class="GtkHBox" id="emails_hbox">
63 <property name="visible">True</property>
64@@ -188,18 +186,19 @@
65 </child>
66 </object>
67 <packing>
68+ <property name="expand">False</property>
69 <property name="position">3</property>
70 </packing>
71 </child>
72 <child>
73 <object class="GtkVBox" id="captcha_solution_vbox">
74 <property name="visible">True</property>
75- <property name="spacing">10</property>
76 <child>
77 <placeholder/>
78 </child>
79 </object>
80 <packing>
81+ <property name="expand">False</property>
82 <property name="position">4</property>
83 </packing>
84 </child>
85@@ -255,12 +254,14 @@
86 </child>
87 </object>
88 <packing>
89+ <property name="expand">False</property>
90 <property name="position">1</property>
91 </packing>
92 </child>
93 <child>
94 <object class="GtkLabel" id="tc_warning_label">
95 <property name="visible">True</property>
96+ <property name="xalign">0</property>
97 <property name="label">tc warning</property>
98 <property name="wrap">True</property>
99 </object>
100@@ -270,64 +271,87 @@
101 </child>
102 </object>
103 <packing>
104+ <property name="expand">False</property>
105 <property name="position">6</property>
106 </packing>
107 </child>
108 <child>
109- <object class="GtkHButtonBox" id="hbuttonbox1">
110+ <object class="GtkHBox" id="hbox2">
111 <property name="visible">True</property>
112 <property name="spacing">5</property>
113- <property name="layout_style">end</property>
114 <child>
115- <object class="GtkButton" id="join_cancel_button">
116- <property name="label">gtk-cancel</property>
117+ <object class="GtkHButtonBox" id="hbuttonbox9">
118 <property name="visible">True</property>
119- <property name="can_focus">True</property>
120- <property name="receives_default">True</property>
121- <property name="use_stock">True</property>
122+ <property name="layout_style">start</property>
123+ <child>
124+ <object class="GtkLinkButton" id="login_button">
125+ <property name="label">login button</property>
126+ <property name="visible">True</property>
127+ <property name="can_focus">True</property>
128+ <property name="receives_default">True</property>
129+ <property name="relief">none</property>
130+ <signal name="clicked" handler="on_sign_in_button_clicked"/>
131+ </object>
132+ <packing>
133+ <property name="expand">False</property>
134+ <property name="fill">False</property>
135+ <property name="position">0</property>
136+ </packing>
137+ </child>
138 </object>
139 <packing>
140 <property name="expand">False</property>
141- <property name="fill">False</property>
142 <property name="position">0</property>
143 </packing>
144 </child>
145 <child>
146- <object class="GtkButton" id="join_ok_button">
147- <property name="label">gtk-go-forward</property>
148+ <object class="GtkHButtonBox" id="hbuttonbox1">
149 <property name="visible">True</property>
150- <property name="can_focus">True</property>
151- <property name="receives_default">True</property>
152- <property name="use_stock">True</property>
153- <signal name="clicked" handler="on_join_ok_button_clicked"/>
154+ <property name="spacing">5</property>
155+ <property name="layout_style">end</property>
156+ <child>
157+ <object class="GtkButton" id="join_cancel_button">
158+ <property name="label">gtk-cancel</property>
159+ <property name="visible">True</property>
160+ <property name="can_focus">True</property>
161+ <property name="receives_default">True</property>
162+ <property name="use_stock">True</property>
163+ </object>
164+ <packing>
165+ <property name="expand">False</property>
166+ <property name="fill">False</property>
167+ <property name="position">0</property>
168+ </packing>
169+ </child>
170+ <child>
171+ <object class="GtkButton" id="join_ok_button">
172+ <property name="label">gtk-go-forward</property>
173+ <property name="visible">True</property>
174+ <property name="can_focus">True</property>
175+ <property name="receives_default">True</property>
176+ <property name="use_stock">True</property>
177+ <signal name="clicked" handler="on_join_ok_button_clicked"/>
178+ </object>
179+ <packing>
180+ <property name="expand">False</property>
181+ <property name="fill">False</property>
182+ <property name="position">1</property>
183+ </packing>
184+ </child>
185 </object>
186 <packing>
187 <property name="expand">False</property>
188- <property name="fill">False</property>
189+ <property name="pack_type">end</property>
190 <property name="position">1</property>
191 </packing>
192 </child>
193 </object>
194 <packing>
195 <property name="expand">False</property>
196+ <property name="pack_type">end</property>
197 <property name="position">7</property>
198 </packing>
199 </child>
200- <child>
201- <object class="GtkLinkButton" id="login_button">
202- <property name="label" translatable="yes">login button</property>
203- <property name="visible">True</property>
204- <property name="can_focus">True</property>
205- <property name="receives_default">True</property>
206- <property name="has_tooltip">True</property>
207- <property name="relief">none</property>
208- <signal name="clicked" handler="on_sign_in_button_clicked"/>
209- </object>
210- <packing>
211- <property name="expand">False</property>
212- <property name="position">8</property>
213- </packing>
214- </child>
215 </object>
216 <object class="GtkVBox" id="processing_vbox">
217 <property name="visible">True</property>
218@@ -447,6 +471,21 @@
219 <child>
220 <placeholder/>
221 </child>
222+ </object>
223+ </child>
224+ </object>
225+ <packing>
226+ <property name="position">0</property>
227+ </packing>
228+ </child>
229+ <child>
230+ <object class="GtkHBox" id="hbox3">
231+ <property name="visible">True</property>
232+ <property name="spacing">5</property>
233+ <child>
234+ <object class="GtkHButtonBox" id="hbuttonbox10">
235+ <property name="visible">True</property>
236+ <property name="layout_style">start</property>
237 <child>
238 <object class="GtkLinkButton" id="forgotten_password_button">
239 <property name="label" translatable="yes">button</property>
240@@ -458,65 +497,74 @@
241 <signal name="clicked" handler="on_forgotten_password_button_clicked"/>
242 </object>
243 <packing>
244+ <property name="expand">False</property>
245+ <property name="fill">False</property>
246+ <property name="padding">10</property>
247+ <property name="position">0</property>
248+ </packing>
249+ </child>
250+ </object>
251+ <packing>
252+ <property name="expand">False</property>
253+ <property name="position">0</property>
254+ </packing>
255+ </child>
256+ <child>
257+ <object class="GtkHButtonBox" id="hbuttonbox5">
258+ <property name="visible">True</property>
259+ <property name="spacing">5</property>
260+ <property name="layout_style">end</property>
261+ <child>
262+ <object class="GtkButton" id="login_cancel_button">
263+ <property name="label">gtk-cancel</property>
264+ <property name="visible">True</property>
265+ <property name="can_focus">True</property>
266+ <property name="receives_default">True</property>
267+ <property name="use_stock">True</property>
268+ </object>
269+ <packing>
270+ <property name="expand">False</property>
271+ <property name="fill">False</property>
272+ <property name="position">0</property>
273+ </packing>
274+ </child>
275+ <child>
276+ <object class="GtkButton" id="login_back_button">
277+ <property name="label">gtk-go-back</property>
278+ <property name="visible">True</property>
279+ <property name="can_focus">True</property>
280+ <property name="receives_default">True</property>
281+ <property name="use_stock">True</property>
282+ <signal name="clicked" handler="on_login_back_button_clicked"/>
283+ </object>
284+ <packing>
285+ <property name="expand">False</property>
286+ <property name="fill">False</property>
287+ <property name="position">1</property>
288+ </packing>
289+ </child>
290+ <child>
291+ <object class="GtkButton" id="login_ok_button">
292+ <property name="label">gtk-connect</property>
293+ <property name="visible">True</property>
294+ <property name="can_focus">True</property>
295+ <property name="receives_default">True</property>
296+ <property name="use_stock">True</property>
297+ <signal name="clicked" handler="on_login_connect_button_clicked"/>
298+ </object>
299+ <packing>
300+ <property name="expand">False</property>
301+ <property name="fill">False</property>
302 <property name="position">2</property>
303 </packing>
304 </child>
305 </object>
306- </child>
307- </object>
308- <packing>
309- <property name="position">0</property>
310- </packing>
311- </child>
312- <child>
313- <object class="GtkHButtonBox" id="hbuttonbox5">
314- <property name="visible">True</property>
315- <property name="spacing">5</property>
316- <property name="layout_style">end</property>
317- <child>
318- <object class="GtkButton" id="login_cancel_button">
319- <property name="label">gtk-cancel</property>
320- <property name="visible">True</property>
321- <property name="can_focus">True</property>
322- <property name="receives_default">True</property>
323- <property name="use_stock">True</property>
324- </object>
325- <packing>
326- <property name="expand">False</property>
327- <property name="fill">False</property>
328- <property name="position">0</property>
329- </packing>
330- </child>
331- <child>
332- <object class="GtkButton" id="login_back_button">
333- <property name="label">gtk-go-back</property>
334- <property name="visible">True</property>
335- <property name="can_focus">True</property>
336- <property name="receives_default">True</property>
337- <property name="use_stock">True</property>
338- <signal name="clicked" handler="on_login_back_button_clicked"/>
339- </object>
340- <packing>
341- <property name="expand">False</property>
342- <property name="fill">False</property>
343+ <packing>
344+ <property name="expand">False</property>
345+ <property name="pack_type">end</property>
346 <property name="position">1</property>
347 </packing>
348 </child>
349- <child>
350- <object class="GtkButton" id="login_ok_button">
351- <property name="label">gtk-connect</property>
352- <property name="visible">True</property>
353- <property name="can_focus">True</property>
354- <property name="receives_default">True</property>
355- <property name="use_stock">True</property>
356- <signal name="clicked" handler="on_login_connect_button_clicked"/>
357- </object>
358- <packing>
359- <property name="expand">False</property>
360- <property name="fill">False</property>
361- <property name="position">2</property>
362- </packing>
363- </child>
364 </object>
365 <packing>
366 <property name="expand">False</property>
367@@ -609,6 +657,17 @@
368 <object class="GtkVBox" id="vbox2">
369 <property name="visible">True</property>
370 <child>
371+ <object class="GtkLabel" id="reset_password_help_label">
372+ <property name="visible">True</property>
373+ <property name="label">label</property>
374+ <property name="wrap">True</property>
375+ </object>
376+ <packing>
377+ <property name="expand">False</property>
378+ <property name="position">0</property>
379+ </packing>
380+ </child>
381+ <child>
382 <object class="GtkAlignment" id="alignment1">
383 <property name="visible">True</property>
384 <property name="xscale">0</property>
385@@ -630,22 +689,11 @@
386 </child>
387 </object>
388 <packing>
389- <property name="position">0</property>
390- </packing>
391- </child>
392- <child>
393- <object class="GtkLabel" id="reset_password_help_label">
394- <property name="visible">True</property>
395- <property name="label" translatable="yes">label</property>
396- <property name="wrap">True</property>
397- </object>
398- <packing>
399 <property name="position">1</property>
400 </packing>
401 </child>
402 </object>
403 <packing>
404- <property name="padding">5</property>
405 <property name="position">0</property>
406 </packing>
407 </child>
408@@ -699,7 +747,6 @@
409 <property name="wrap">True</property>
410 </object>
411 <packing>
412- <property name="padding">10</property>
413 <property name="position">0</property>
414 </packing>
415 </child>
416
417=== modified file 'po/POTFILES.in'
418--- po/POTFILES.in 2010-08-20 15:49:23 +0000
419+++ po/POTFILES.in 2010-11-24 12:51:04 +0000
420@@ -1,1 +1,1 @@
421-ubuntu_sso/gui.py
422+ubuntu_sso/gtk/gui.py
423
424=== modified file 'setup.py'
425--- setup.py 2010-11-23 18:43:06 +0000
426+++ setup.py 2010-11-24 12:51:04 +0000
427@@ -36,7 +36,7 @@
428 from distutils.command import clean, build
429
430 # Defining variables for various rules here, similar to a Makefile.am
431-CLEANFILES = ['data/com.ubuntu.sso.service']
432+CLEANFILES = ['data/com.ubuntu.sso.service', 'po/ubuntu-sso-client.pot']
433
434
435 # XXX: This needs some serious cleanup
436@@ -94,8 +94,7 @@
437 long_description='Desktop service to allow applications to sign in' \
438 'to Ubuntu services via SSO',
439 url='https://launchpad.net/ubuntu-sso-client',
440- packages=['ubuntu_sso',
441- 'ubuntu_sso.utils'],
442+ packages=['ubuntu_sso', 'ubuntu_sso.gtk', 'ubuntu_sso.utils'],
443 data_files=[
444 ('share/dbus-1/services', ['data/com.ubuntu.sso.service']),
445 ('lib/ubuntu-sso-client', ['bin/ubuntu-sso-login']),
446
447=== modified file 'ubuntu_sso/credentials.py'
448--- ubuntu_sso/credentials.py 2010-11-22 21:44:05 +0000
449+++ ubuntu_sso/credentials.py 2010-11-24 12:51:04 +0000
450@@ -35,6 +35,7 @@
451
452 """
453
454+import sys
455 import traceback
456 import urllib2
457
458@@ -58,6 +59,8 @@
459 HELP_TEXT_KEY = 'help_text'
460 WINDOW_ID_KEY = 'window_id'
461 PING_URL_KEY = 'ping_url'
462+UI_MODULE_KEY = 'ui_module'
463+UI_CLASS_KEY = 'ui_class'
464 SUCCESS_CB_KEY = 'success_cb'
465 ERROR_CB_KEY = 'error_cb'
466 DENIAL_CB_KEY = 'denial_cb'
467@@ -133,6 +136,7 @@
468
469 def __init__(self, app_name, tc_url=None, help_text='',
470 window_id=0, ping_url=None,
471+ ui_module='ubuntu_sso.gtk.gui', ui_class='UbuntuSSOClientGUI',
472 success_cb=NO_OP, error_cb=NO_OP, denial_cb=NO_OP):
473 """Return a Credentials management object.
474
475@@ -174,6 +178,8 @@
476 self.window_id = window_id
477 self.ping_url = ping_url
478 self.tc_url = tc_url
479+ self.ui_module = ui_module
480+ self.ui_class = ui_class
481 self._success_cb = success_cb
482 self._error_cb = error_cb
483 self.denial_cb = denial_cb
484@@ -203,12 +209,6 @@
485
486 self.success_cb(creds)
487
488- def _login_error_cb(self, dialog, app_name, error):
489- """Handle UI error when login/registration failed."""
490- logger.warning('Login/registration failed app %r, error %r',
491- app_name, error)
492- self.error_cb({ERROR_KEY: error})
493-
494 def _auth_denial_cb(self, dialog, app_name):
495 """The user decided not to allow the registration or login."""
496 logger.warning('Login/registration was denied to app %r', app_name)
497@@ -244,17 +244,17 @@
498 @handle_exceptions(msg='Problem opening the Ubuntu SSO user interface')
499 def _show_ui(self, login_only):
500 """Shows the UI, connect outcome signals."""
501- # delay gui import to be able to function on non-graphical envs
502- from ubuntu_sso import gui
503- self.gui = gui.UbuntuSSOClientGUI(app_name=self.app_name,
504+
505+ __import__(self.ui_module)
506+ gui = sys.modules[self.ui_module]
507+
508+ self.gui = getattr(gui, self.ui_class)(app_name=self.app_name,
509 tc_url=self.tc_url, help_text=self.help_text,
510 window_id=self.window_id, login_only=login_only)
511
512 self.gui.connect(gui.SIG_LOGIN_SUCCEEDED, self._login_success_cb)
513- self.gui.connect(gui.SIG_LOGIN_FAILED, self._login_error_cb)
514 self.gui.connect(gui.SIG_REGISTRATION_SUCCEEDED,
515 self._login_success_cb)
516- self.gui.connect(gui.SIG_REGISTRATION_FAILED, self._login_error_cb)
517 self.gui.connect(gui.SIG_USER_CANCELATION, self._auth_denial_cb)
518
519 @handle_failures(msg='Problem while retrieving credentials')
520
521=== added directory 'ubuntu_sso/gtk'
522=== added file 'ubuntu_sso/gtk/__init__.py'
523--- ubuntu_sso/gtk/__init__.py 1970-01-01 00:00:00 +0000
524+++ ubuntu_sso/gtk/__init__.py 2010-11-24 12:51:04 +0000
525@@ -0,0 +1,19 @@
526+# -*- coding: utf-8 -*-
527+#
528+# Author: Natalia Bidart <natalia.bidart@canonical.com>
529+#
530+# Copyright 2009-2010 Canonical Ltd.
531+#
532+# This program is free software: you can redistribute it and/or modify it
533+# under the terms of the GNU General Public License version 3, as published
534+# by the Free Software Foundation.
535+#
536+# This program is distributed in the hope that it will be useful, but
537+# WITHOUT ANY WARRANTY; without even the implied warranties of
538+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
539+# PURPOSE. See the GNU General Public License for more details.
540+#
541+# You should have received a copy of the GNU General Public License along
542+# with this program. If not, see <http://www.gnu.org/licenses/>.
543+
544+"""Ubuntu Single Sign On graphical interface."""
545
546=== renamed file 'ubuntu_sso/gui.py' => 'ubuntu_sso/gtk/gui.py'
547--- ubuntu_sso/gui.py 2010-11-03 14:28:46 +0000
548+++ ubuntu_sso/gtk/gui.py 2010-11-24 12:51:04 +0000
549@@ -36,7 +36,8 @@
550
551 from dbus.mainloop.glib import DBusGMainLoop
552
553-from ubuntu_sso import DBUS_ACCOUNT_PATH, DBUS_BUS_NAME, DBUS_IFACE_USER_NAME
554+from ubuntu_sso import (DBUS_ACCOUNT_PATH, DBUS_BUS_NAME, DBUS_IFACE_USER_NAME,
555+ NO_OP)
556 from ubuntu_sso.logger import setup_logging
557
558
559@@ -66,23 +67,17 @@
560 WEBKIT_WEB_NAVIGATION_REASON_FORM_RESUBMITTED = 4
561 WEBKIT_WEB_NAVIGATION_REASON_OTHER = 5
562
563-
564-NO_OP = lambda *args, **kwargs: None
565 DEFAULT_WIDTH = 30
566 # To be replaced by values from the theme (LP: #616526)
567 HELP_TEXT_COLOR = gtk.gdk.Color("#bfbfbf")
568 WARNING_TEXT_COLOR = gtk.gdk.Color("red")
569
570-SIG_LOGIN_FAILED = 'login-failed'
571 SIG_LOGIN_SUCCEEDED = 'login-succeeded'
572-SIG_REGISTRATION_FAILED = 'registration-failed'
573 SIG_REGISTRATION_SUCCEEDED = 'registration-succeeded'
574 SIG_USER_CANCELATION = 'user-cancelation'
575
576 SIGNAL_ARGUMENTS = [
577- (SIG_LOGIN_FAILED, (gobject.TYPE_STRING, gobject.TYPE_STRING)),
578 (SIG_LOGIN_SUCCEEDED, (gobject.TYPE_STRING, gobject.TYPE_STRING,)),
579- (SIG_REGISTRATION_FAILED, (gobject.TYPE_STRING, gobject.TYPE_STRING)),
580 (SIG_REGISTRATION_SUCCEEDED, (gobject.TYPE_STRING, gobject.TYPE_STRING,)),
581 (SIG_USER_CANCELATION, (gobject.TYPE_STRING,)),
582 ]
583@@ -95,7 +90,8 @@
584 def get_data_dir():
585 """Build absolute path to the 'data' directory."""
586 module = os.path.dirname(__file__)
587- result = os.path.abspath(os.path.join(module, os.pardir, 'data'))
588+ result = os.path.abspath(os.path.join(module, os.pardir,
589+ os.pardir, 'data'))
590 logger.debug('get_data_file: trying to load from %r (exists? %s)',
591 result, os.path.exists(result))
592 if os.path.exists(result):
593@@ -298,11 +294,12 @@
594 setattr(self, name, obj)
595 if 'warning' in name:
596 self.warnings.append(obj)
597- obj.hide()
598+ obj.set_text('')
599 if 'cancel_button' in name:
600 obj.connect('clicked', self.on_close_clicked)
601 self.cancels.append(obj)
602 if 'label' in name:
603+ obj.connect('size-allocate', self.on_size_allocate)
604 self.labels.append(obj)
605
606 self.entries = (u'name_entry', u'email1_entry', u'email2_entry',
607@@ -343,24 +340,18 @@
608 self._append_page(self._build_set_new_password_page())
609 self._append_page(self._build_verify_email_page())
610
611- window_size = None
612 if not login_only:
613- window_size = (550, 500)
614 self._append_page(self._build_enter_details_page())
615 self._append_page(self._build_tc_page())
616 self.login_button.grab_focus()
617 self._set_current_page(self.enter_details_vbox)
618 else:
619- window_size = (400, 350)
620 self.login_back_button.hide()
621 self.login_ok_button.grab_focus()
622 self.login_vbox.help_text = help_text
623 self._set_current_page(self.login_vbox)
624
625- self.window.set_size_request(*window_size)
626- size_req = (int(window_size[0] * 0.9), -1)
627- for label in self.labels:
628- label.set_size_request(*size_req)
629+ self.window.connect('size-allocate', self.on_size_allocate)
630
631 self._signals = {
632 'CaptchaGenerated':
633@@ -501,7 +492,6 @@
634 """Clear all warning messages."""
635 for widget in self.warnings:
636 widget.set_text('')
637- widget.hide()
638 for widget in self.entries:
639 getattr(self, widget).clear_warning()
640
641@@ -518,7 +508,7 @@
642
643 def _set_header(self, header):
644 """Set 'header' as the window title and header."""
645- markup = '<span size="xx-large">%s</span>'
646+ markup = '<span size="x-large">%s</span>'
647 self.header_label.set_markup(markup % header)
648 self.window.set_title(self.header_label.get_text()) # avoid markup
649
650@@ -533,7 +523,7 @@
651 if warning_text is not None:
652 self._set_warning_message(self.warning_label, warning_text)
653 else:
654- self.warning_label.hide()
655+ self.warning_label.set_text('')
656
657 for page in self.pages:
658 if page is current_page:
659@@ -756,6 +746,10 @@
660 self._done = True
661 self._set_current_page(self.error_vbox)
662
663+ def on_size_allocate(self, widget, allocation):
664+ """The widget can re rezised, embrase it!."""
665+ widget.set_size_request(allocation.width, allocation.height)
666+
667 def on_close_clicked(self, *args, **kwargs):
668 """Call self.close_callback if defined."""
669 if os.path.exists(self._captcha_filename):
670
671=== added directory 'ubuntu_sso/gtk/tests'
672=== added file 'ubuntu_sso/gtk/tests/__init__.py'
673--- ubuntu_sso/gtk/tests/__init__.py 1970-01-01 00:00:00 +0000
674+++ ubuntu_sso/gtk/tests/__init__.py 2010-11-24 12:51:04 +0000
675@@ -0,0 +1,19 @@
676+# -*- coding: utf-8 -*-
677+#
678+# Author: Natalia Bidart <natalia.bidart@canonical.com>
679+#
680+# Copyright 2009 Canonical Ltd.
681+#
682+# This program is free software: you can redistribute it and/or modify it
683+# under the terms of the GNU General Public License version 3, as published
684+# by the Free Software Foundation.
685+#
686+# This program is distributed in the hope that it will be useful, but
687+# WITHOUT ANY WARRANTY; without even the implied warranties of
688+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
689+# PURPOSE. See the GNU General Public License for more details.
690+#
691+# You should have received a copy of the GNU General Public License along
692+# with this program. If not, see <http://www.gnu.org/licenses/>.
693+
694+"""Tests for the Ubuntu SSO graphical interface."""
695
696=== renamed file 'ubuntu_sso/tests/test_gui.py' => 'ubuntu_sso/gtk/tests/test_gui.py'
697--- ubuntu_sso/tests/test_gui.py 2010-11-03 14:28:46 +0000
698+++ ubuntu_sso/gtk/tests/test_gui.py 2010-11-24 12:51:04 +0000
699@@ -32,7 +32,7 @@
700 from twisted.trial.unittest import TestCase
701
702 from contrib.testing.testcase import MementoHandler
703-from ubuntu_sso import gui
704+from ubuntu_sso.gtk import gui
705 from ubuntu_sso.tests import (APP_NAME, TC_URL, HELP_TEXT, CAPTCHA_ID,
706 CAPTCHA_SOLUTION, EMAIL, EMAIL_TOKEN, NAME, PASSWORD, RESET_PASSWORD_TOKEN)
707
708@@ -410,12 +410,12 @@
709
710 def assert_warnings_visibility(self, visible=False):
711 """Every warning label should be 'visible'."""
712- msg = '"%s" should be %svisible.'
713+ msg = '"%s" should have %sempty content.'
714 for name in self.ui.widgets:
715 widget = getattr(self.ui, name)
716 if 'warning' in name:
717- self.assertEqual(visible, widget.get_property('visible'),
718- msg % (name, '' if visible else 'not '))
719+ self.assertEqual('', widget.get_text(),
720+ msg % (name, '' if visible else 'non-'))
721 elif 'entry' in name:
722 self.assertEqual(widget.warning, '')
723
724@@ -595,15 +595,14 @@
725 entry = getattr(self.ui, name)
726 self.assertTrue(entry.get_activates_default(), msg % (name,))
727
728- def test_initial_size_for_labels(self):
729- """Labels have the correct width."""
730- expected = (int(self.ui.window.get_size_request()[0] * 0.9), -1)
731- msg = 'Label %r must have size request %s (got %s instead).'
732+ def test_label_size_allocated_is_connected(self):
733+ """Labels have the size-allocate signal connected."""
734+ msg = 'Label %r must have size-allocate connected.'
735 labels = [i for i in self.ui.widgets if 'label' in i]
736 for label in labels:
737 widget = getattr(self.ui, label)
738- actual = widget.get_size_request()
739- self.assertEqual(expected, actual, msg % (label, expected, actual))
740+ widget.emit('size-allocate', gtk.gdk.Rectangle(1, 2, 3, 4))
741+ self.assertEqual(widget.get_size_request(), (3, 4), msg % (label,))
742
743 def test_password_fields_are_password(self):
744 """Password fields have the is_password flag set."""
745@@ -614,8 +613,8 @@
746 widget = getattr(self.ui, name)
747 self.assertTrue(widget.is_password, msg % name)
748
749- def test_warning_fields_are_hidden(self):
750- """Every warning label should be not visible."""
751+ def test_warning_fields_are_cleared(self):
752+ """Every warning label should be cleared."""
753 self.assert_warnings_visibility()
754
755 def test_cancel_buttons_close_window(self):
756@@ -1525,7 +1524,7 @@
757 self.click_connect_with_valid_data()
758 self.ui.on_login_error(app_name=APP_NAME, error=self.error)
759 self.ui.login_back_button.clicked()
760- self.assertFalse(self.ui.warning_label.get_property('visible'))
761+ self.assert_warnings_visibility()
762
763 def test_login_ok_button_does_nothing_if_clicked_but_disabled(self):
764 """The join form can only be submitted if the button is sensitive."""
765
766=== modified file 'ubuntu_sso/main.py'
767--- ubuntu_sso/main.py 2010-11-22 21:44:05 +0000
768+++ ubuntu_sso/main.py 2010-11-24 12:51:04 +0000
769@@ -37,7 +37,8 @@
770 DBUS_IFACE_CRED_NAME, DBUS_CREDENTIALS_IFACE, NO_OP)
771 from ubuntu_sso.account import Account
772 from ubuntu_sso.credentials import (Credentials, HELP_TEXT_KEY, PING_URL_KEY,
773- TC_URL_KEY, WINDOW_ID_KEY, SUCCESS_CB_KEY, ERROR_CB_KEY, DENIAL_CB_KEY,
774+ TC_URL_KEY, UI_CLASS_KEY, UI_MODULE_KEY, WINDOW_ID_KEY,
775+ SUCCESS_CB_KEY, ERROR_CB_KEY, DENIAL_CB_KEY,
776 ERROR_KEY, ERROR_DETAIL_KEY)
777 from ubuntu_sso.keyring import get_token_name, U1_APP_NAME, Keyring
778 from ubuntu_sso.logger import setup_logging
779@@ -423,10 +424,12 @@
780 # Operator not preceded by a space (fails with dbus decorators)
781 # pylint: disable=C0322
782
783+ valid_keys = (HELP_TEXT_KEY, PING_URL_KEY, TC_URL_KEY,
784+ UI_CLASS_KEY, UI_MODULE_KEY, WINDOW_ID_KEY)
785+
786 def _parse_args(self, args):
787 """Retrieve values from the generic param 'args'."""
788- result = dict((k, v) for k, v in args.iteritems() if k in
789- (HELP_TEXT_KEY, PING_URL_KEY, TC_URL_KEY, WINDOW_ID_KEY))
790+ result = dict(i for i in args.iteritems() if i[0] in self.valid_keys)
791 result[WINDOW_ID_KEY] = int(args.get(WINDOW_ID_KEY, 0))
792 result[SUCCESS_CB_KEY] = self.CredentialsFound
793 result[ERROR_CB_KEY] = self.CredentialsError
794
795=== modified file 'ubuntu_sso/tests/__init__.py'
796--- ubuntu_sso/tests/__init__.py 2010-10-05 15:59:07 +0000
797+++ ubuntu_sso/tests/__init__.py 2010-11-24 12:51:04 +0000
798@@ -27,6 +27,8 @@
799 CAPTCHA_SOLUTION = 'william Byrd'
800 EMAIL = 'test@example.com'
801 EMAIL_TOKEN = 'B2Pgtf'
802+GTK_GUI_CLASS = 'UbuntuSSOClientGUI'
803+GTK_GUI_MODULE = 'ubuntu_sso.gtk.gui'
804 HELP_TEXT = """Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sed
805 lorem nibh. Suspendisse gravida nulla non nunc suscipit pulvinar tempus ut
806 augue. Morbi consequat, ligula a elementum pretium, dolor nulla tempus metus,
807
808=== modified file 'ubuntu_sso/tests/bin/show_gui'
809--- ubuntu_sso/tests/bin/show_gui 2010-10-01 15:21:25 +0000
810+++ ubuntu_sso/tests/bin/show_gui 2010-11-24 12:51:04 +0000
811@@ -22,7 +22,7 @@
812 import gtk
813 import sys
814
815-from ubuntu_sso.gui import UbuntuSSOClientGUI
816+from ubuntu_sso.gtk.gui import UbuntuSSOClientGUI
817
818
819 APP_NAME = 'Ubuntu'
820
821=== modified file 'ubuntu_sso/tests/test_credentials.py'
822--- ubuntu_sso/tests/test_credentials.py 2010-11-22 21:44:05 +0000
823+++ ubuntu_sso/tests/test_credentials.py 2010-11-24 12:51:04 +0000
824@@ -28,11 +28,12 @@
825 from twisted.trial.unittest import TestCase, FailTest
826
827 from contrib.testing.testcase import MementoHandler
828-from ubuntu_sso import credentials, gui
829+from ubuntu_sso import credentials
830 from ubuntu_sso.credentials import (APP_NAME_KEY, HELP_TEXT_KEY, NO_OP,
831- PING_URL_KEY, TC_URL_KEY, WINDOW_ID_KEY, ERROR_KEY, ERROR_DETAIL_KEY)
832-from ubuntu_sso.tests import (APP_NAME, EMAIL, HELP_TEXT, PING_URL, TC_URL,
833- TOKEN, WINDOW_ID)
834+ PING_URL_KEY, TC_URL_KEY, UI_CLASS_KEY, UI_MODULE_KEY, WINDOW_ID_KEY,
835+ ERROR_KEY, ERROR_DETAIL_KEY)
836+from ubuntu_sso.tests import (APP_NAME, EMAIL, GTK_GUI_CLASS, GTK_GUI_MODULE,
837+ HELP_TEXT, PING_URL, TC_URL, TOKEN, WINDOW_ID)
838
839
840 # Access to a protected member of a client class
841@@ -48,7 +49,50 @@
842 HELP_TEXT_KEY: HELP_TEXT,
843 WINDOW_ID_KEY: WINDOW_ID,
844 PING_URL_KEY: PING_URL,
845-}
846+ UI_MODULE_KEY: 'ubuntu_sso.tests.test_credentials',
847+ UI_CLASS_KEY: 'FakedClientGUI',
848+}
849+
850+UI_KWARGS = {
851+ APP_NAME_KEY: APP_NAME,
852+ TC_URL_KEY: TC_URL,
853+ HELP_TEXT_KEY: HELP_TEXT,
854+ WINDOW_ID_KEY: WINDOW_ID,
855+}
856+
857+SIG_LOGIN_SUCCEEDED = '1'
858+SIG_REGISTRATION_SUCCEEDED = '2'
859+SIG_USER_CANCELATION = '3'
860+
861+
862+class SampleMiscException(Exception):
863+ """An error to be used while testing."""
864+
865+
866+class FailingClientGUI(object):
867+ """Fake a failing SSO GUI."""
868+
869+ def __init__(self, *args, **kwargs):
870+ raise SampleMiscException('A failing GUI class.')
871+
872+
873+class FakedClientGUI(object):
874+ """Fake a SSO GUI."""
875+
876+ def __init__(self, *args, **kwargs):
877+ self.args = args
878+ self.kwargs = kwargs
879+ self.signals = []
880+ self.methods = []
881+ self.connect = lambda *a: self.signals.append(a)
882+
883+ def finish_success(self):
884+ """Fake the success finish."""
885+ self.methods.append('finish_success')
886+
887+ def finish_error(self, error):
888+ """Fake the error finish."""
889+ self.methods.append(('finish_error', error))
890
891
892 class BasicTestCase(TestCase):
893@@ -78,31 +122,6 @@
894 def setUp(self):
895 """Init."""
896 super(CredentialsTestCase, self).setUp()
897- self.args = None
898- self.kwargs = None
899- self.signals = []
900- self.methods = []
901-
902- class FakedUbuntuSSOClientGUI(object):
903- """Fake a SSO GUI."""
904-
905- # Method should have 'self' as first argument
906- # pylint: disable=E0213
907-
908- def __init__(sself, *args, **kwargs):
909- self.args = args
910- self.kwargs = kwargs
911- sself.connect = lambda *a: self.signals.append(a)
912-
913- def finish_success(sself):
914- """Fake the success finish."""
915- self.methods.append('finish_success')
916-
917- def finish_error(sself, error):
918- """Fake the error finish."""
919- self.methods.append(('finish_error', error))
920-
921- self.patch(gui, 'UbuntuSSOClientGUI', FakedUbuntuSSOClientGUI)
922 self.obj = credentials.Credentials(success_cb=self.success,
923 error_cb=self.error,
924 denial_cb=self.denial,
925@@ -191,6 +210,22 @@
926
927 self.assertEqual(getattr(self.obj, PING_URL_KEY), None)
928
929+ def test_ui_class_defaults_to_gtk(self):
930+ """The ui class defaults to gtk."""
931+ newkw = KWARGS.copy()
932+ newkw.pop(UI_CLASS_KEY)
933+ self.obj = credentials.Credentials(**newkw)
934+
935+ self.assertEqual(getattr(self.obj, UI_CLASS_KEY), GTK_GUI_CLASS)
936+
937+ def test_ui_module_defaults_to_gtk(self):
938+ """The ui module defaults to gtk."""
939+ newkw = KWARGS.copy()
940+ newkw.pop(UI_MODULE_KEY)
941+ self.obj = credentials.Credentials(**newkw)
942+
943+ self.assertEqual(getattr(self.obj, UI_MODULE_KEY), GTK_GUI_MODULE)
944+
945 def test_success_cb_gui_none(self):
946 """Success callback calls the caller but not the GUI."""
947 self.obj.gui = None
948@@ -198,17 +233,15 @@
949
950 self.assertEqual(self._called, (('success', APP_NAME, TOKEN), {}),
951 'caller _success_cb was called.')
952- self.assertEqual(self.methods, [],
953- 'GUI finish_success was not called.')
954
955 def test_success_cb_gui_not_none(self):
956 """Success callback calls the caller and finish the GUI."""
957- self.obj.gui = gui.UbuntuSSOClientGUI(APP_NAME)
958+ self.obj.gui = ui = FakedClientGUI(APP_NAME)
959 self.obj.success_cb(creds=TOKEN)
960
961 self.assertEqual(self._called, (('success', APP_NAME, TOKEN), {}),
962 'caller _success_cb was called.')
963- self.assertEqual(self.methods, ['finish_success'],
964+ self.assertEqual(ui.methods, ['finish_success'],
965 'GUI finish_success was called.')
966 self.assertTrue(self.obj.gui is None, 'gui is reset to None.')
967
968@@ -220,18 +253,16 @@
969
970 self.assertEqual(self._called, (('error', APP_NAME, error_dict), {}),
971 'caller _error_cb was called.')
972- self.assertEqual(self.methods, [],
973- 'GUI finish_error was not called.')
974
975 def test_error_cb_gui_not_none(self):
976 """Error callback calls the caller and finish the GUI."""
977- self.obj.gui = gui.UbuntuSSOClientGUI(APP_NAME)
978+ self.obj.gui = ui = FakedClientGUI(APP_NAME)
979 error_dict = {'foo': 'bar'}
980 self.obj.error_cb(error_dict=error_dict)
981
982 self.assertEqual(self._called, (('error', APP_NAME, error_dict), {}),
983 'caller _error_cb was called.')
984- self.assertEqual(self.methods, [('finish_error', error_dict)],
985+ self.assertEqual(ui.methods, [('finish_error', error_dict)],
986 'GUI finish_error was called.')
987 self.assertTrue(self.obj.gui is None, 'gui is reset to None.')
988
989@@ -341,23 +372,15 @@
990 self.assertEqual(self._called, (('success', APP_NAME, TOKEN), {}))
991
992
993-class CredentialsLoginErrorTestCase(CredentialsTestCase):
994- """Test suite for the Credentials login error callback."""
995-
996- def test_login_error_cb(self):
997- """On login/register error, self.error_cb is called."""
998- self.obj._login_error_cb(dialog=None, app_name=APP_NAME, error='Bla')
999- self.assert_error_cb_called(msg='Bla')
1000-
1001-
1002 class CredentialsAuthDeniedTestCase(CredentialsTestCase):
1003 """Test suite for the Credentials auth denied callback."""
1004
1005 def test_auth_denial_cb(self):
1006 """On auth denied, self.denial_cb is called."""
1007+ self.obj.gui = ui = FakedClientGUI(APP_NAME)
1008 self.obj._auth_denial_cb(dialog=None, app_name=APP_NAME)
1009 self.assertEqual(self._called, (('denial', APP_NAME), {}))
1010- self.assertEqual(self.methods, [], 'no GUI method was called.')
1011+ self.assertEqual(ui.methods, [], 'no GUI method was called.')
1012
1013
1014 class PingUrlTestCase(CredentialsTestCase):
1015@@ -420,10 +443,6 @@
1016 self.assertTrue(self.memento.check_exception(FailTest, error))
1017
1018
1019-class SampleMiscException(Exception):
1020- """An error to be used while testing."""
1021-
1022-
1023 class FindCredentialsTestCase(CredentialsTestCase):
1024 """Test suite for the find_credentials method."""
1025 timeout = 5
1026@@ -518,6 +537,11 @@
1027 operation = 'register'
1028 login_only = False
1029
1030+ def setUp(self):
1031+ super(RegisterTestCase, self).setUp()
1032+ self.ui_kwargs = UI_KWARGS.copy()
1033+ self.ui_kwargs['login_only'] = self.login_only
1034+
1035 @inlineCallbacks
1036 def test_with_existent_token(self):
1037 """The operation returns the credentials if already in keyring."""
1038@@ -536,10 +560,7 @@
1039
1040 yield getattr(self.obj, self.operation)()
1041
1042- expected = KWARGS.copy()
1043- expected.pop(PING_URL_KEY)
1044- expected['login_only'] = self.login_only
1045- self.assertEqual(expected, self.kwargs)
1046+ self.assertEqual(self.obj.gui.kwargs, self.ui_kwargs)
1047
1048 @inlineCallbacks
1049 def test_with_exception_on_credentials(self):
1050@@ -559,14 +580,15 @@
1051 """The operation calls the error callback if a GUI exception occurs."""
1052 self.patch(credentials.Keyring, 'get_credentials',
1053 lambda kr, app: defer.succeed(None))
1054- err = 'Ble'
1055- self.patch(gui, 'UbuntuSSOClientGUI', lambda *a, **kw: self.fail(err))
1056+ err = 'A failing GUI class.'
1057+ self.obj.ui_class = 'FailingClientGUI'
1058
1059 yield getattr(self.obj, self.operation)()
1060
1061 msg = 'Problem opening the Ubuntu SSO user interface'
1062- self.assert_error_cb_called(msg=msg, detailed_error=FailTest(err))
1063- self.assertTrue(self.memento.check_exception(FailTest, err))
1064+ self.assert_error_cb_called(msg=msg,
1065+ detailed_error=SampleMiscException(err))
1066+ self.assertTrue(self.memento.check_exception(SampleMiscException, err))
1067
1068 @inlineCallbacks
1069 def test_connects_gui_signals(self):
1070@@ -575,14 +597,12 @@
1071 lambda kr, app: defer.succeed(None))
1072
1073 expected = [
1074- (gui.SIG_LOGIN_SUCCEEDED, self.obj._login_success_cb),
1075- (gui.SIG_LOGIN_FAILED, self.obj._login_error_cb),
1076- (gui.SIG_REGISTRATION_SUCCEEDED, self.obj._login_success_cb),
1077- (gui.SIG_REGISTRATION_FAILED, self.obj._login_error_cb),
1078- (gui.SIG_USER_CANCELATION, self.obj._auth_denial_cb),
1079+ (SIG_LOGIN_SUCCEEDED, self.obj._login_success_cb),
1080+ (SIG_REGISTRATION_SUCCEEDED, self.obj._login_success_cb),
1081+ (SIG_USER_CANCELATION, self.obj._auth_denial_cb),
1082 ]
1083 yield getattr(self.obj, self.operation)()
1084- self.assertEqual(self.signals, expected)
1085+ self.assertEqual(self.obj.gui.signals, expected)
1086
1087 @inlineCallbacks
1088 def test_gui_is_created(self):
1089@@ -592,13 +612,9 @@
1090
1091 yield getattr(self.obj, self.operation)()
1092
1093- self.assertIsInstance(self.obj.gui, gui.UbuntuSSOClientGUI)
1094- self.assertEqual(self.args, ())
1095-
1096- expected = KWARGS.copy()
1097- expected.pop(PING_URL_KEY)
1098- expected['login_only'] = self.login_only
1099- self.assertEqual(self.kwargs, expected)
1100+ self.assertIsInstance(self.obj.gui, FakedClientGUI)
1101+ self.assertEqual(self.obj.gui.args, ())
1102+ self.assertEqual(self.obj.gui.kwargs, self.ui_kwargs)
1103
1104
1105 class LoginTestCase(RegisterTestCase):
1106
1107=== modified file 'ubuntu_sso/tests/test_main.py'
1108--- ubuntu_sso/tests/test_main.py 2010-11-22 21:44:05 +0000
1109+++ ubuntu_sso/tests/test_main.py 2010-11-24 12:51:04 +0000
1110@@ -37,7 +37,8 @@
1111 from ubuntu_sso.main import (U1_PING_URL, blocking, except_to_errdict,
1112 CredentialsManagement, SSOCredentials, SSOLogin)
1113 from ubuntu_sso.main import (HELP_TEXT_KEY, PING_URL_KEY,
1114- TC_URL_KEY, WINDOW_ID_KEY, SUCCESS_CB_KEY, ERROR_CB_KEY, DENIAL_CB_KEY)
1115+ TC_URL_KEY, UI_CLASS_KEY, UI_MODULE_KEY, WINDOW_ID_KEY,
1116+ SUCCESS_CB_KEY, ERROR_CB_KEY, DENIAL_CB_KEY)
1117 from ubuntu_sso.tests import (APP_NAME, TC_URL, HELP_TEXT, CAPTCHA_ID,
1118 CAPTCHA_SOLUTION, EMAIL, EMAIL_TOKEN, PASSWORD, PING_URL, TOKEN,
1119 TOKEN_NAME, WINDOW_ID)
1120@@ -666,7 +667,9 @@
1121 """Tests for the CredentialsManagement DBus interface."""
1122
1123 base_args = {HELP_TEXT_KEY: HELP_TEXT, PING_URL_KEY: PING_URL,
1124- TC_URL_KEY: TC_URL, WINDOW_ID_KEY: WINDOW_ID}
1125+ TC_URL_KEY: TC_URL, WINDOW_ID_KEY: WINDOW_ID,
1126+ UI_CLASS_KEY: 'SuperUI', UI_MODULE_KEY: 'foo.bar.baz',
1127+ }
1128
1129 def setUp(self):
1130 self.mocker = Mocker()

Subscribers

People subscribed via source and target branches