Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test sidebars API based on capabilities, not roles #24902

Open
adamziel opened this issue Aug 28, 2020 · 0 comments
Open

Test sidebars API based on capabilities, not roles #24902

adamziel opened this issue Aug 28, 2020 · 0 comments
Labels
[Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Type] Enhancement A suggestion for improvement.

Comments

@adamziel
Copy link
Contributor

At the moment, the unit tests for the sidebars endpoint are checking for "admin", "editor", "author", "subscriber" roles:

public function test_get_items_wrong_permission_author() {
wp_set_current_user( self::$author_id );
$request = new WP_REST_Request( 'GET', '/__experimental/sidebars' );
$response = rest_get_server()->dispatch( $request );
$this->assertErrorResponse( 'widgets_cannot_access', $response, 403 );
}

It would be way better to test based on the capabilities (edit_theme_options maybe?).

@talldan talldan added the [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. label Sep 16, 2020
@jordesign jordesign added the [Type] Enhancement A suggestion for improvement. label Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants