Merge lp:~facundo/ubuntuone-client/fix-1011822 into lp:ubuntuone-client

Proposed by Facundo Batista on 2012-09-07
Status: Merged
Approved by: dobey on 2012-09-07
Approved revision: 1309
Merged at revision: 1309
Proposed branch: lp:~facundo/ubuntuone-client/fix-1011822
Merge into: lp:ubuntuone-client
Diff against target: 26 lines (+8/-2)
1 file modified
tests/platform/credentials/test_linux.py (+8/-2)
To merge this branch: bzr merge lp:~facundo/ubuntuone-client/fix-1011822
Reviewer Review Type Date Requested Status
dobey (community) 2012-09-07 Approve on 2012-09-07
Review via email: mp+123370@code.launchpad.net

Commit Message

Decode the gettext string before compare (LP: #1011822).

Description of the Change

Decode the gettext string before compare.

To post a comment you must log in.
dobey (dobey) wrote :

Looks ok, though I really don't like doing special case logic in tests to deal with situations like this. And unfortunately the class-based API is not usable for this code, it seems (the install call would be inappropriate, and translation fails if no .mo file exists for the language).

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/platform/credentials/test_linux.py'
2--- tests/platform/credentials/test_linux.py 2012-06-14 16:54:45 +0000
3+++ tests/platform/credentials/test_linux.py 2012-09-07 21:22:19 +0000
4@@ -384,7 +384,10 @@
5 yield d
6
7 self.assertEqual(self.sso_server._app_name, APP_NAME)
8- params = dict(UI_PARAMS)
9+ # convert to unicode for the comparison, as the message is arriving
10+ # here as bytes (bad gettext usage!)
11+ params = dict((x, y.decode("utf8") if isinstance(y, str) else y)
12+ for x, y in UI_PARAMS.items())
13 params.update(self.args)
14 self.assertEqual(self.sso_server._args, params)
15
16@@ -397,7 +400,10 @@
17 yield d
18
19 self.assertEqual(self.sso_server._app_name, APP_NAME)
20- params = dict(UI_PARAMS)
21+ # convert to unicode for the comparison, as the message is arriving
22+ # here as bytes (bad gettext usage!)
23+ params = dict((x, y.decode("utf8") if isinstance(y, str) else y)
24+ for x, y in UI_PARAMS.items())
25 params.update(self.args)
26 self.assertEqual(self.sso_server._args, params)
27

Subscribers

People subscribed via source and target branches