Merge lp:~henninge/launchpad/bug-824435-failure-reporting-2 into lp:launchpad
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Graham Binns | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 13766 | ||||
Proposed branch: | lp:~henninge/launchpad/bug-824435-failure-reporting-2 | ||||
Merge into: | lp:launchpad | ||||
Prerequisite: | lp:~henninge/launchpad/bug-824435-failure-reporting | ||||
Diff against target: |
964 lines (+479/-213) 12 files modified
lib/lp/app/javascript/client.js (+5/-6) lib/lp/app/javascript/formoverlay/tests/test_formoverlay.js (+10/-15) lib/lp/app/javascript/picker/tests/test_picker_patcher.js (+20/-31) lib/lp/app/javascript/testing/iorecorder.js (+0/-60) lib/lp/app/javascript/testing/mockio.js (+147/-67) lib/lp/app/javascript/testing/tests/test_mockio.html (+21/-0) lib/lp/app/javascript/testing/tests/test_mockio.js (+242/-0) lib/lp/app/javascript/tests/test_lp_client.html (+1/-1) lib/lp/app/javascript/tests/test_lp_client.js (+14/-12) lib/lp/code/javascript/requestbuild_overlay.js (+3/-6) lib/lp/code/javascript/tests/test_requestbuild_overlay.html (+1/-1) lib/lp/code/javascript/tests/test_requestbuild_overlay.js (+15/-14) |
||||
To merge this branch: | bzr merge lp:~henninge/launchpad/bug-824435-failure-reporting-2 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Graham Binns (community) | code | Approve | |
Review via email:
|
Commit message
[r=gmb][bug=824435][no-qa][incr] Merge lazr.testing.mockio and lp.testing.
Description of the change
= Summary =
Since the Thunderdome we had two Javascript modules to mock Y.io in
tests: lazr.testing.mockio and lp.testing.
pretty similar in their approach so merging the two was not only
necessary but also fairly easy. The new module is lp.testing.mockio
and contains the best of both previous modules.
I was surprised to find that these were only used in so few places but
that made transitioning the old code to the new mockio a quick task,
too.
I noticed this because I had started to extend IORecorder's
functionality for the orginial fixing of the error reporting in the
requestbuild_
series.
== Proposed fix ==
Merge iorecorder.js code into mockio.js and call it lp.testing.mockio.
Add tests for the new module, the old code was completely untested.
Also clean up the interface and provide some helpers to make
instrumenting the code under test less intrusive.
== Pre-implementation notes ==
I talked to Aaron and Deryck about this but the need for this merge
was really too blatantly obvious.
== Implementation details ==
There is a test in test_picker_
shortened) a great deal because the new MockIo learned from IORecorder
how to handle multiple requests.
The mockio.js file looks as if it is completely replace and although
that is almost true, I also added some indentation which changed
most lines in the file.
Looking at test_success_
test_failure_
raise an exception when the status code does is not correct but I
don't know how to test for assertions being raised.
While iorecorder passed the "io" function to the instrumented function
under test, mockio passes a object that has an "io" method. I picked
the latter approach because it mirrors "Y.io" more closely and does
away with the need to Y.bind the io function.
I exposed MockHttpResponse in the module, like iorecorder did because
there is a test that uses just that.
Any thing else that needs explainin, just ask. ;-)
== Tests ==
firefox lib/lp/
firefox lib/lp/
firefox lib/lp/
firefox lib/lp/
firefox lib/lp/
== Demo and Q/A ==
No QA, only test code touched.
= Launchpad lint =
As the diff is already big enough, I will not fix the remaining lint
in requestbuild_
follow-up branch anyway.
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
./lib/lp/
40: Expected '===' and instead saw '=='.
45: Expected '!==' and instead saw '!='.
70: Expected '===' and instead saw '=='.
72: ['name'] is better written in dot notation.
111: Expected '===' and instead saw '=='.
112: Expected '===' and instead saw '=='.
113: Expected '{' and instead saw 'header'.
116: Expected '{' and instead saw 'header'.
119: Expected '!==' and instead saw '!='.
121: Expected '===' and instead saw '=='.
224: Expected '!==' and instead saw '!='.
225: Expected '{' and instead saw 'error_msg'.
236: Use the array literal notation [].
258: Expected '{' and instead saw 'return'.
272: Expected ';' and instead saw 'if'.
273: Expected '===' and instead saw '=='.
287: Expected '{' and instead saw 'return'.
321: ['builds'] is better written in dot notation.
323: ['already_pending'] is better written in dot notation.
325: ['errors'] is better written in dot notation.
328: Expected '!==' and instead saw '!='.
340: Expected '!==' and instead saw '!='.
341: Expected '!==' and instead saw '!='.
342: Expected '{' and instead saw 'error_
344: Expected '{' and instead saw 'error_
347: Move 'var' declarations to the top of the function.
347: Stopping. (67% scanned).
0: JSLINT had a fatal error.
161: Line has trailing whitespace.