Merge lp:~mandel/ubuntu-sso-client/appname-ssl into lp:ubuntu-sso-client

Proposed by Manuel de la Peña
Status: Merged
Approved by: Natalia Bidart
Approved revision: 899
Merged at revision: 900
Proposed branch: lp:~mandel/ubuntu-sso-client/appname-ssl
Merge into: lp:ubuntu-sso-client
Diff against target: 144 lines (+23/-9)
3 files modified
ubuntu_sso/qt/ssl_dialog.py (+8/-3)
ubuntu_sso/qt/tests/test_ssl_dialog.py (+13/-5)
ubuntu_sso/utils/ui.py (+2/-1)
To merge this branch: bzr merge lp:~mandel/ubuntu-sso-client/appname-ssl
Reviewer Review Type Date Requested Status
Natalia Bidart (community) Approve
Review via email: mp+95928@code.launchpad.net

Commit message

Ensure that the strings used in sso do not have ubuntu one in them.

Description of the change

Ensure that the strings used in sso do not have ubuntu one in them.

To post a comment you must log in.
899. By Manuel de la Peña

Make appname to never be empty since it will make the UI look terrible.

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Looks great!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu_sso/qt/ssl_dialog.py'
2--- ubuntu_sso/qt/ssl_dialog.py 2012-02-29 14:28:56 +0000
3+++ ubuntu_sso/qt/ssl_dialog.py 2012-03-05 16:35:19 +0000
4@@ -35,6 +35,7 @@
5 from ubuntu_sso.qt.ui.ssl_dialog_ui import Ui_SSLDialog
6 from ubuntu_sso.utils.ui import (
7 CANCEL_BUTTON,
8+ SSL_APPNAME_HELP,
9 SSL_DETAILS_HELP,
10 SSL_DIALOG_TITLE,
11 SSL_DESCRIPTION,
12@@ -64,7 +65,7 @@
13 class SSLDialog(QDialog):
14 """"Dialog used to show SSL exceptions."""
15
16- def __init__(self, domain=None, details=None, parent=None):
17+ def __init__(self, app_name, domain=None, details=None, parent=None):
18 """Create a new instance."""
19 super(SSLDialog, self).__init__()
20 if domain is None:
21@@ -75,6 +76,7 @@
22 logger.debug('Details passed as None.')
23 details = ''
24 self.details = details
25+ self.app_name = app_name
26 self.ssl_text = None
27 self.expander = None
28 self.ui = Ui_SSLDialog()
29@@ -94,7 +96,8 @@
30 second_reason=SSL_SECOND_REASON,
31 third_reason=SSL_THIRD_REASON)
32 self.ui.intro_label.setText(intro)
33- self.ui.not_sure_label.setText(SSL_NOT_SURE)
34+ self.ui.not_sure_label.setText(SSL_NOT_SURE %
35+ {'app_name': self.app_name})
36 self.ui.remember_checkbox.setText(SSL_REMEMBER_DECISION)
37
38 def _on_cancel_clicked(self):
39@@ -142,6 +145,8 @@
40 help=SSL_DOMAIN_HELP)
41 parser.add_argument('--details', required=True,
42 help=SSL_DETAILS_HELP)
43+ parser.add_argument('--appname', required=True,
44+ help=SSL_APPNAME_HELP)
45 return parser.parse_args()
46
47
48@@ -151,6 +156,6 @@
49 app = QApplication(sys.argv)
50 # pylint: enable=W0612
51 args = parse_args()
52- win = SSLDialog(domain=args.domain, details=args.details)
53+ win = SSLDialog(args.appname, domain=args.domain, details=args.details)
54 return_code = win.exec_()
55 sys.exit(return_code)
56
57=== modified file 'ubuntu_sso/qt/tests/test_ssl_dialog.py'
58--- ubuntu_sso/qt/tests/test_ssl_dialog.py 2012-03-01 14:49:41 +0000
59+++ ubuntu_sso/qt/tests/test_ssl_dialog.py 2012-03-05 16:35:19 +0000
60@@ -24,6 +24,7 @@
61 from ubuntu_sso.qt import ssl_dialog
62 from ubuntu_sso.utils.ui import (
63 CANCEL_BUTTON,
64+ SSL_APPNAME_HELP,
65 SSL_DETAILS_HELP,
66 SSL_DESCRIPTION,
67 SSL_DOMAIN_HELP,
68@@ -51,8 +52,10 @@
69 yield super(SSLDialogTestCase, self).setUp()
70 self.domain = 'test-domain'
71 self.details = 'SSL details'
72+ self.appname = 'test'
73
74- self.dialog = ssl_dialog.SSLDialog(domain=self.domain,
75+ self.dialog = ssl_dialog.SSLDialog(self.appname,
76+ domain=self.domain,
77 details=self.details)
78 self.return_code = None
79
80@@ -64,13 +67,15 @@
81
82 def test_init_none_domain(self):
83 """Test the init method when the domain is none."""
84- dialog = ssl_dialog.SSLDialog(domain=None, details=self.details)
85+ dialog = ssl_dialog.SSLDialog(self.appname, domain=None,
86+ details=self.details)
87 self.assertEqual(self.details, dialog.details)
88 self.assertEqual('', dialog.domain)
89
90 def test_init_none_details(self):
91 """Test the init method when the details are none."""
92- dialog = ssl_dialog.SSLDialog(domain=self.domain, details=None)
93+ dialog = ssl_dialog.SSLDialog(self.appname, domain=self.domain,
94+ details=None)
95 self.assertEqual('', dialog.details)
96 self.assertEqual(self.domain, dialog.domain)
97
98@@ -84,7 +89,7 @@
99 second_reason=SSL_SECOND_REASON,
100 third_reason=SSL_THIRD_REASON)
101 self.assertEqual(intro, unicode(self.dialog.ui.intro_label.text()))
102- self.assertEqual(SSL_NOT_SURE,
103+ self.assertEqual(SSL_NOT_SURE % dict(app_name=self.appname),
104 unicode(self.dialog.ui.not_sure_label.text()))
105 self.assertEqual(SSL_REMEMBER_DECISION,
106 unicode(self.dialog.ui.remember_checkbox.text()))
107@@ -119,7 +124,8 @@
108 self.patch(ssl_dialog.SSLDialog, '_on_cancel_clicked',
109 fake_on_cancel_clicked)
110
111- dialog = ssl_dialog.SSLDialog(domain=None, details=self.details)
112+ dialog = ssl_dialog.SSLDialog(self.appname, domain=None,
113+ details=self.details)
114
115 dialog.ui.connect_button.clicked.emit(True)
116 self.assertIn('_on_connect_clicked', called)
117@@ -188,4 +194,6 @@
118 argparse.called)
119 self.assertIn(('add_argument', '--details', True, SSL_DETAILS_HELP),
120 argparse.called)
121+ self.assertIn(('add_argument', '--appname', True, SSL_APPNAME_HELP),
122+ argparse.called)
123 self.assertIn(('parse_args',), argparse.called)
124
125=== modified file 'ubuntu_sso/utils/ui.py'
126--- ubuntu_sso/utils/ui.py 2012-03-01 15:21:00 +0000
127+++ ubuntu_sso/utils/ui.py 2012-03-05 16:35:19 +0000
128@@ -125,6 +125,7 @@
129 SET_UP_ACCOUNT_BUTTON = _('Set Up Account')
130 SET_UP_ACCOUNT_CHOICE_BUTTON = _('I don\'t have an account yet - sign me up')
131 SIGN_IN_BUTTON = _('Sign In')
132+SSL_APPNAME_HELP = _('the appname whose ssl error we are going to show.')
133 SSL_CERT_DETAILS = _('Certificate details')
134 SSL_CONNECT_BUTTON = _('Connect')
135 SSL_DETAILS_HELP = _('the details ssl certificate we are going to show.')
136@@ -138,7 +139,7 @@
137 SSL_HEADER = _('Do you want to connect to this server?')
138 SSL_HELP_BUTTON = _('Get Help With SSL')
139 SSL_NOT_SURE = _('If you are not sure about this server, do not use it to'
140- ' connect to Ubuntu One.')
141+ ' connect to %(app_name)s.')
142 SSL_REMEMBER_DECISION = _('Remember my settings for this certificate.')
143 SSL_SECOND_REASON = _('The name on the certificate isn\'t valid or doesn\'t'
144 ' match the name of the site')

Subscribers

People subscribed via source and target branches