REST API: Add missing assertions to the view and embed context response data for the Users Controller.

Adds tests for responses where `context != 'edit'` the following properties are not included in the response data:
- `email`
- `locale`
- `registered_date`

Props thepelkus, jnylen0.
Fixes #39399.


git-svn-id: https://develop.svn.wordpress.org/trunk@39660 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Rachel Baker 2017-01-02 18:42:22 +00:00
parent 1aec30fba8
commit 511e4c67dd
1 changed files with 3 additions and 1 deletions

View File

@ -2111,12 +2111,14 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase {
if ( 'edit' !== $context ) {
$this->assertArrayNotHasKey( 'roles', $data );
$this->assertArrayNotHasKey( 'capabilities', $data );
$this->assertArrayNotHasKey( 'registered', $data );
$this->assertArrayNotHasKey( 'registered_date', $data );
$this->assertArrayNotHasKey( 'first_name', $data );
$this->assertArrayNotHasKey( 'last_name', $data );
$this->assertArrayNotHasKey( 'nickname', $data );
$this->assertArrayNotHasKey( 'email', $data );
$this->assertArrayNotHasKey( 'extra_capabilities', $data );
$this->assertArrayNotHasKey( 'username', $data );
$this->assertArrayNotHasKey( 'locale', $data );
}
$this->assertEqualSets( array(