[wp-trac] [WordPress Trac] #54420: Tests: Mock REST API remote requests

WordPress Trac noreply at wordpress.org
Thu Nov 11 15:47:20 UTC 2021


#54420: Tests: Mock REST API remote requests
------------------------------+-----------------------
 Reporter:  hellofromTonya    |       Owner:  (none)
     Type:  task (blessed)    |      Status:  new
 Priority:  normal            |   Milestone:  6.0
Component:  Build/Test Tools  |     Version:
 Severity:  normal            |  Resolution:
 Keywords:                    |     Focuses:  rest-api
------------------------------+-----------------------
Description changed by hellofromTonya:

Old description:

> Recent timeout failures ([https://github.com/WordPress/wordpress-
> develop/runs/4174016878?check_suite_focus=true see GitHub failed job]) of
> specific REST API tests show some tests are not mocking the remote
> requests. These requests can be mocked with a callback hooked into
> `'pre_http_request'` filter.
>
> Each test should be reviewed to determine:
> * If a remote request to a live API endpoint is being made
> * If those specific requests should/can be mocked
> * and then mocks created for each in its context of the condition under
> test

New description:

 Recent timeout failures ([https://github.com/WordPress/wordpress-
 develop/runs/4174016878?check_suite_focus=true see GitHub failed job]) of
 specific REST API tests show some tests are not mocking the remote
 requests. These requests can be mocked with a callback hooked into
 `'pre_http_request'` filter.

 Each test should be reviewed to determine:
 * If a remote request to a live API endpoint is being made
 * If those specific requests should/can be mocked
 * and then mocks created for each in its context of the condition under
 test

 Ideally a mocking strategy could be created to abstract the heavy lifting
 and make it easier for these tests to mock the requests.

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54420#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list