Merge lp:~mfisch/ubuntu-community-accomplishments/lp1092312 into lp:ubuntu-community-accomplishments

Proposed by Matt Fischer
Status: Needs review
Proposed branch: lp:~mfisch/ubuntu-community-accomplishments/lp1092312
Merge into: lp:ubuntu-community-accomplishments
Diff against target: 79 lines (+18/-9)
3 files modified
Changelog (+8/-2)
scripts/ubuntu-community/support/registered-on-askubuntu.py (+9/-6)
tests/ubuntu-community/support/askubuntu-quorum (+1/-1)
To merge this branch: bzr merge lp:~mfisch/ubuntu-community-accomplishments/lp1092312
Reviewer Review Type Date Requested Status
Jono Bacon Pending
Review via email: mp+141201@code.launchpad.net

Description of the change

Fix the test error by not assuming the list has data, run pep8, and remove an unused import. Also fix the test failure for askubuntu-quorum.

To post a comment you must log in.
249. By Matt Fischer

also fix the test failure for askubuntu-quorum

Unmerged revisions

249. By Matt Fischer

also fix the test failure for askubuntu-quorum

248. By Matt Fischer

fixing the battery failure for registered on askubuntu, also ran pep8 on it and removed unused import

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Changelog'
2--- Changelog 2012-12-23 21:50:29 +0000
3+++ Changelog 2012-12-24 05:22:21 +0000
4@@ -21,8 +21,10 @@
5 [Howard Chan]
6 * New accomplishment: Testcase Admins
7 * New accomplishment: First Bug Fixed
8- * Changed all accomplishments with name="Sliver Fox" to "s.fox" to avoid duplicates (LP: #1080346)
9- * Fixed the Testcase Admins Accomplishments test file to fix the failing tests (LP: #1092310)
10+ * Changed all accomplishments with name="Sliver Fox" to "s.fox" to avoid
11+ duplicates (LP: #1080346)
12+ * Fixed the Testcase Admins Accomplishments test file to fix the failing
13+ tests (LP: #1092310)
14
15 [Daniel Ejsing-Duun]
16 * New accomplishment: Chat on IRC
17@@ -32,4 +34,8 @@
18
19 [Philip Ballew]
20 * New accomplishment: Youth Council Member
21+
22+ [Matthew Fischer]
23+ * Fixed a bug in the registered-on-askubuntu script that caused a test
24+ failure (LP: #1092312)
25 -------------------------------------------------------------------------
26
27=== modified file 'scripts/ubuntu-community/support/registered-on-askubuntu.py'
28--- scripts/ubuntu-community/support/registered-on-askubuntu.py 2012-08-01 19:22:31 +0000
29+++ scripts/ubuntu-community/support/registered-on-askubuntu.py 2012-12-24 05:22:21 +0000
30@@ -1,15 +1,16 @@
31 #!/usr/bin/python
32-import traceback, sys
33+import traceback
34+import sys
35 import json
36 import gzip
37-import simplejson
38 import urllib2
39 import StringIO
40 from accomplishments.daemon import dbusapi
41
42 try:
43 api = dbusapi.Accomplishments()
44- userurl = api.get_extra_information("ubuntu-community", "askubuntu-user-url")
45+ userurl = api.get_extra_information(
46+ "ubuntu-community", "askubuntu-user-url")
47 if bool(userurl[0]["askubuntu-user-url"]) == False:
48 sys.exit(1)
49 else:
50@@ -30,7 +31,11 @@
51
52 user_raw = gzipr.read()
53 user_data = json.loads(user_raw)
54- user_type = user_data['items'][0]['user_type']
55+ items = user_data['items']
56+ if not items:
57+ sys.exit(1)
58+ else:
59+ user_type = items[0]['user_type']
60
61 if user_type == 'registered' or user_type == 'moderator':
62 sys.exit(0)
63@@ -45,5 +50,3 @@
64 except:
65 traceback.print_exc()
66 sys.exit(2)
67-
68-
69
70=== modified file 'tests/ubuntu-community/support/askubuntu-quorum'
71--- tests/ubuntu-community/support/askubuntu-quorum 2012-05-30 17:51:37 +0000
72+++ tests/ubuntu-community/support/askubuntu-quorum 2012-12-24 05:22:21 +0000
73@@ -1,5 +1,5 @@
74 [success]
75-askubuntu-user-url = http://askubuntu.com/users/66563/adrian
76+askubuntu-user-url = http://askubuntu.com/users/73/mfisch
77
78 [failure]
79 askubuntu-user-url = http://askubuntu.com/users/67229/accomplishmentsvalid

Subscribers

People subscribed via source and target branches

to all changes: