Opened 6 years ago
Closed 6 years ago
#40734 closed defect (bug) (fixed)
REST API: Tests: Prohibit errors when generating wp-api.js fixtures
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.8 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | has-patch |
Focuses: | rest-api | Cc: |
Description
In #39264 we added tests for wp-api.js
to core, including a wp-api-generated.js
fixture file that is automatically generated from API requests during test suite runs.
While reviewing #40450 I found that some of these requests are erroring, so we are storing error responses in the fixture data. For example:
- https://core.trac.wordpress.org/browser/tags/4.7.4/tests/qunit/fixtures/wp-api-generated.js#L3394
- https://core.trac.wordpress.org/browser/tags/4.7.4/tests/qunit/fixtures/wp-api-generated.js#L3567
I fixed this by requiring a 200
status code for these requests (they are all GET
requests) and updating everything to send the right kind of data. I also needed to update the $fixture_replacements
array which replaces dynamic data with static values - instructions for doing so are at comment:29:ticket:39264.
Note, the patch attached to this ticket needs to be applied after #40450.
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
In 40629: