Title-change for failure provides un-parseable json

Bug #770718 reported by Michael Nelson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Software Center Agent
Fix Released
Low
Michael Nelson

Bug Description

In current trunk, when reporting a failed purchase, the returned JSON isn't JSON (as it is missing a comma):

It looks like this was introduced while adding the user_cancelled property. It's unfortunate that it's quite difficult for us to test reliably, given that our test runner doesn't execute JS.

Also, there is an inconsistency between: false and "False" being returned as values for different attributes ('successful' and 'user_cancelled' respectively). Looking at the SC code which does parsed_json.get('user_cancelled', False), I assume it should indeed be the json false, rather than a string.

STR:
(Note: I assume this is also reproducible with the SC client, but steps here aren't dependent on the client - feel free to update)
 1) Access https://sc.staging.ubuntu.com/subscriptions/en/ubuntu/maverick/+new/?archive_id=canonical-isd-hackers/internal-qa&arch=i386 (or relevant server) and cancel the purchase (if it isn't already),
 2) Use your browsers javascript debugger to copy the title (ie. for me it was: { "successful" : false, "failures" : "Error while checking or creating a LP person: [Errno 111] Connection refused" "user_cancelled" : "False"}
 3) In your JS debugger try to eval your json: eval({ "successful" : false, "failures" : "Error while checking or creating a LP person: [Errno 111] Connection refused" "user_cancelled" : "False"}) - you'll get a syntax error. Add a comma before "user_cancelled" and it will work.

Tags: kb-defect sp-1
description: updated
Changed in software-center-agent:
status: New → Fix Committed
Revision history for this message
Michael Nelson (michael.nelson) wrote :

QA step output for the VPS:

1) Accessed: http://173.212.255.144/subscriptions/en/ubuntu/maverick/+new/?archive_id=mvo/private-test&arch=i386 and was redirected to payment screen.
2) Cancelled the payment (which took a while?),
3) Ran the following on the server::
   $ cd /home/hudson/django_project
   $ sudo ./manage.py process-payment-notifications --include-paymentinitiated
4) Watched the browser tab which ended up with the following in its title: <title>{ "successful" : false, "failures" : "" "user_cancelled" : "True"}</title> (which is un-parsable).
5) Deployed the new version to the VPS (with r242)
6) Went back to the browser tab and reloaded the subscription, which showed the correct title json: <title>{"successful": false, "failures": "", "user_cancelled": true}</title> (ie. it's now parsable, and the boolean value is a json boolean, rather than a string).

Changed in software-center-agent:
assignee: nobody → Michael Nelson (michael.nelson)
Changed in software-center-agent:
importance: Undecided → Low
tags: added: kb-defect sp-1
Changed in software-center-agent:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.