Merge lp:~diegosarmentero/ubuntu-sso-client/930724 into lp:ubuntu-sso-client

Proposed by Diego Sarmentero
Status: Merged
Approved by: Natalia Bidart
Approved revision: 860
Merged at revision: 862
Proposed branch: lp:~diegosarmentero/ubuntu-sso-client/930724
Merge into: lp:ubuntu-sso-client
Diff against target: 182 lines (+86/-8)
5 files modified
ubuntu_sso/qt/current_user_sign_in_page.py (+9/-2)
ubuntu_sso/qt/email_verification_page.py (+13/-3)
ubuntu_sso/qt/tests/test_current_user_sign_in_page.py (+19/-2)
ubuntu_sso/qt/tests/test_email_verification.py (+43/-1)
ubuntu_sso/qt/ubuntu_sso_wizard.py (+2/-0)
To merge this branch: bzr merge lp:~diegosarmentero/ubuntu-sso-client/930724
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Natalia Bidart (community) Approve
Review via email: mp+92773@code.launchpad.net

Commit message

- Fixed: Qt UI: when calling login or validate_email, should pass the ping_url (LP: #930724).

To post a comment you must log in.
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Looks great!

review: Approve
Revision history for this message
Roberto Alsina (ralsina) wrote :

+1

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

The attempt to merge lp:~diegosarmentero/ubuntu-sso-client/930724 into lp:ubuntu-sso-client failed. Below is the output from the failed tests.

*** Running GTK test suite for ubuntu_sso ***
ubuntu_sso.tests.test_account
  AccountTestCase
    test_generate_captcha ... [OK]
    test_is_not_validated ... [OK]
    test_is_not_validated_empty_result ... [OK]
    test_is_validated ... [OK]
    test_login_if_http_error ... [OK]
    test_login_if_no_error ... [OK]
    test_register_user_checks_valid_email ... [OK]
    test_register_user_checks_valid_password ... [OK]
    test_register_user_if_status_error ... [OK]
    test_register_user_if_status_error_with_string_message ... [OK]
    test_register_user_if_status_ok ... [OK]
    test_register_user_if_status_unknown ... [OK]
    test_request_password_reset_token_if_http_error ... [OK]
    test_request_password_reset_token_if_status_ok ... [OK]
    test_request_password_reset_token_if_status_unknown ... [OK]
    test_set_new_password_if_http_error ... [OK]
    test_set_new_password_if_status_ok ... [OK]
    test_set_new_password_if_status_unknown ... [OK]
    test_validate_email_if_status_error ... [OK]
    test_validate_email_if_status_error_with_string_message ... [OK]
    test_validate_email_if_status_ok ... [OK]
    test_validate_email_if_status_unknown ... [OK]
  EnvironOverridesTestCase
    test_no_override_service_url ... [OK]
    test_override_service_url ... [OK]
    test_service_url_as_parameter ... [OK]
twisted.trial.unittest
  TestCase
    runTest ... [OK]
ubuntu_sso.tests.test_account
  TimestampedAuthorizerTestCase
    test_authorize_request_includes_timestamp ... [OK]
ubuntu_sso.tests.test_credentials
  BasicTestCase
    runTest ... [OK]
  ClearCredentialsTestCase
    test_clear_credentials ... [OK]
    test_keyring_failure ... [OK]
  CredentialsCallbacksTestCase
    test_creation_parameters_are_stored ... [OK]
    test_help_text_defaults_to_empty_string ... [OK]
    test_ping_url_defaults_to_none ... [OK]
    test_policy_url_defaults_to_none ... [OK]
    test_tc...

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

The attempt to merge lp:~diegosarmentero/ubuntu-sso-client/930724 into lp:ubuntu-sso-client failed. Below is the output from the failed tests.

*** Running GTK test suite for ubuntu_sso ***
ubuntu_sso.tests.test_account
  AccountTestCase
    test_generate_captcha ... [OK]
    test_is_not_validated ... [OK]
    test_is_not_validated_empty_result ... [OK]
    test_is_validated ... [OK]
    test_login_if_http_error ... [OK]
    test_login_if_no_error ... [OK]
    test_register_user_checks_valid_email ... [OK]
    test_register_user_checks_valid_password ... [OK]
    test_register_user_if_status_error ... [OK]
    test_register_user_if_status_error_with_string_message ... [OK]
    test_register_user_if_status_ok ... [OK]
    test_register_user_if_status_unknown ... [OK]
    test_request_password_reset_token_if_http_error ... [OK]
    test_request_password_reset_token_if_status_ok ... [OK]
    test_request_password_reset_token_if_status_unknown ... [OK]
    test_set_new_password_if_http_error ... [OK]
    test_set_new_password_if_status_ok ... [OK]
    test_set_new_password_if_status_unknown ... [OK]
    test_validate_email_if_status_error ... [OK]
    test_validate_email_if_status_error_with_string_message ... [OK]
    test_validate_email_if_status_ok ... [OK]
    test_validate_email_if_status_unknown ... [OK]
  EnvironOverridesTestCase
    test_no_override_service_url ... [OK]
    test_override_service_url ... [OK]
    test_service_url_as_parameter ... [OK]
twisted.trial.unittest
  TestCase
    runTest ... [OK]
ubuntu_sso.tests.test_account
  TimestampedAuthorizerTestCase
    test_authorize_request_includes_timestamp ... [OK]
ubuntu_sso.tests.test_credentials
  BasicTestCase
    runTest ... [OK]
  ClearCredentialsTestCase
    test_clear_credentials ... [OK]
    test_keyring_failure ... [OK]
  CredentialsCallbacksTestCase
    test_creation_parameters_are_stored ... [OK]
    test_help_text_defaults_to_empty_string ... [OK]
    test_ping_url_defaults_to_none ... [OK]
    test_policy_url_defaults_to_none ... [OK]
    test_tc...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu_sso/qt/current_user_sign_in_page.py'
2--- ubuntu_sso/qt/current_user_sign_in_page.py 2012-02-10 21:09:38 +0000
3+++ ubuntu_sso/qt/current_user_sign_in_page.py 2012-02-13 14:11:18 +0000
4@@ -44,8 +44,9 @@
5 passwordForgotten = QtCore.pyqtSignal()
6 userNotValidated = QtCore.pyqtSignal('QString', 'QString')
7
8- def __init__(self, ui, *args, **kwargs):
9+ def __init__(self, ui, ping_url, *args, **kwargs):
10 super(CurrentUserSignInPage, self).__init__(ui, *args, **kwargs)
11+ self.ping_url = ping_url
12
13 self._signals = {
14 'LoggedIn':
15@@ -135,7 +136,13 @@
16 # grab the data from the view and call the backend
17 email = unicode(self.ui.email_edit.text())
18 password = unicode(self.ui.password_edit.text())
19- self.backend.login(self.app_name, email, password)
20+ args = (self.app_name, email, password)
21+ if self.ping_url:
22+ f = self.backend.login_and_ping
23+ args = args + (self.ping_url,)
24+ else:
25+ f = self.backend.login
26+ f(*args)
27
28 def on_login_error(self, app_name, error):
29 """There was an error when login in."""
30
31=== modified file 'ubuntu_sso/qt/email_verification_page.py'
32--- ubuntu_sso/qt/email_verification_page.py 2012-02-10 21:24:28 +0000
33+++ ubuntu_sso/qt/email_verification_page.py 2012-02-13 14:11:18 +0000
34@@ -37,8 +37,9 @@
35
36 registrationSuccess = QtCore.pyqtSignal('QString', 'QString')
37
38- def __init__(self, ui, *args, **kwargs):
39+ def __init__(self, ui, ping_url, *args, **kwargs):
40 super(EmailVerificationPage, self).__init__(ui, *args, **kwargs)
41+ self.ping_url = ping_url
42 self.email = ''
43 self.password = ''
44 self._signals = {
45@@ -104,8 +105,17 @@
46 """Call the next action."""
47 logger.debug('EmailVerificationController.validate_email')
48 code = unicode(self.ui.verification_code_edit.text())
49- self.backend.validate_email(self.app_name,
50- self.email, self.password, code)
51+ args = (self.app_name, self.email, self.password, code)
52+ if self.ping_url:
53+ f = self.backend.validate_email_and_ping
54+ args = args + (self.ping_url,)
55+ else:
56+ f = self.backend.validate_email
57+
58+ logger.info('Calling validate_email with email %r, password <hidden>, '
59+ 'app_name %r and email_token %r.', self.email,
60+ self.app_name, code)
61+ f(*args)
62
63 def on_email_validated(self, app_name, *args, **kwargs):
64 """Signal thrown after the email is validated."""
65
66=== modified file 'ubuntu_sso/qt/tests/test_current_user_sign_in_page.py'
67--- ubuntu_sso/qt/tests/test_current_user_sign_in_page.py 2012-02-10 21:09:38 +0000
68+++ ubuntu_sso/qt/tests/test_current_user_sign_in_page.py 2012-02-13 14:11:18 +0000
69@@ -50,6 +50,7 @@
70 "userNotValidated", FakeSignal())
71 self.ui = current_user_sign_in_page.CurrentUserSignInPage(
72 current_user_sign_in_ui.Ui_CurrentUserSignInPage(),
73+ '',
74 parent=None)
75 self.wizard = FakeWizard()
76 self.patch(self.ui, 'wizard', lambda: self.wizard)
77@@ -167,8 +168,24 @@
78 self.assertTrue(button.properties['unpolish'])
79 self.assertTrue(button.properties['polish'])
80
81- def test_login(self):
82- """Test the login method."""
83+ def test_login_with_ping(self):
84+ """Test the login method."""
85+ ping = 'http://ping.me'
86+ self.ui.ping_url = ping
87+ exposed_methods = ['login', 'login_and_ping']
88+ self.patch(FakedObject, "exposed_methods", exposed_methods)
89+ faked_object = FakedObject()
90+ self.patch(self.ui, "backend", faked_object)
91+ self.ui.ui.email_edit.setText('valid@email')
92+ self.ui.ui.password_edit.setText('123456')
93+ self.ui.login()
94+ self.assertTrue('login_and_ping' in self.ui.backend._called)
95+ self.assertEqual(self.ui.backend._called['login_and_ping'],
96+ ((None, u'valid@email', u'123456', ping), {}))
97+
98+ def test_login_without_ping(self):
99+ """Test the login method."""
100+ self.ui.ping_url = ''
101 exposed_methods = ['login']
102 self.patch(FakedObject, "exposed_methods", exposed_methods)
103 faked_object = FakedObject()
104
105=== modified file 'ubuntu_sso/qt/tests/test_email_verification.py'
106--- ubuntu_sso/qt/tests/test_email_verification.py 2012-02-10 21:09:38 +0000
107+++ ubuntu_sso/qt/tests/test_email_verification.py 2012-02-13 14:11:18 +0000
108@@ -44,7 +44,7 @@
109 self.patch(email_verification_page.EmailVerificationPage,
110 "registrationSuccess", FakeSignal())
111 self.ui = email_verification_page.EmailVerificationPage(
112- email_verification_ui.Ui_EmailVerificationPage(),
113+ email_verification_ui.Ui_EmailVerificationPage(), '',
114 parent=None)
115 self.wizard = FakeWizard()
116 self.patch(self.ui, 'wizard', lambda: self.wizard)
117@@ -167,3 +167,45 @@
118 self.ui.registrationSuccess.connect(slot)
119 self.ui.on_email_validated(app_name)
120 self.assertTrue((app_name, email) in self.signals_results)
121+
122+ def test_validate_email_with_ping(self):
123+ """Test the login method."""
124+ ping = 'http://ping.me'
125+ app_name = 'app_name'
126+ email = 'email@example.com'
127+ password = 'password'
128+ code = 'code'
129+ self.ui.ping_url = ping
130+ self.ui.app_name = app_name
131+ self.ui.email = email
132+ self.ui.password = password
133+ self.ui.ui.verification_code_edit.setText(code)
134+ exposed_methods = ['validate_email', 'validate_email_and_ping']
135+ self.patch(FakedObject, "exposed_methods", exposed_methods)
136+ faked_object = FakedObject()
137+ self.patch(self.ui, "backend", faked_object)
138+ self.ui.validate_email()
139+ self.assertTrue('validate_email_and_ping' in self.ui.backend._called)
140+ self.assertEqual(self.ui.backend._called['validate_email_and_ping'],
141+ ((app_name, email, password, code, ping), {}))
142+
143+ def test_validate_email_without_ping(self):
144+ """Test the login method."""
145+ ping = ''
146+ app_name = 'app_name'
147+ email = 'email@example.com'
148+ password = 'password'
149+ code = 'code'
150+ self.ui.ping_url = ping
151+ self.ui.app_name = app_name
152+ self.ui.email = email
153+ self.ui.password = password
154+ self.ui.ui.verification_code_edit.setText(code)
155+ exposed_methods = ['validate_email', 'validate_email_and_ping']
156+ self.patch(FakedObject, "exposed_methods", exposed_methods)
157+ faked_object = FakedObject()
158+ self.patch(self.ui, "backend", faked_object)
159+ self.ui.validate_email()
160+ self.assertTrue('validate_email' in self.ui.backend._called)
161+ self.assertEqual(self.ui.backend._called['validate_email'],
162+ ((app_name, email, password, code), {}))
163
164=== modified file 'ubuntu_sso/qt/ubuntu_sso_wizard.py'
165--- ubuntu_sso/qt/ubuntu_sso_wizard.py 2012-02-10 21:09:38 +0000
166+++ ubuntu_sso/qt/ubuntu_sso_wizard.py 2012-02-13 14:11:18 +0000
167@@ -94,6 +94,7 @@
168 self._move_to_email_verification_page)
169
170 self.current_user = CurrentUserSignInPage(Ui_CurrentUserSignInPage(),
171+ self.ping_url,
172 app_name=self.app_name,
173 parent=self)
174 self.current_user.userNotValidated.connect(
175@@ -104,6 +105,7 @@
176
177 self.email_verification = EmailVerificationPage(
178 Ui_EmailVerificationPage(),
179+ self.ping_url,
180 app_name=self.app_name)
181 self.email_verification.registrationSuccess.connect(
182 self._move_to_success_page)

Subscribers

People subscribed via source and target branches