WordPress.org

Make WordPress Core

Opened 4 months ago

Closed 3 months ago

#39546 closed enhancement (fixed)

REST API: Improve test coverage of single users endpoint for public author data

Reported by: rachelbaker Owned by: jnylen0
Milestone: 4.8 Priority: normal
Severity: normal Version: 4.7
Component: REST API Keywords: has-patch
Focuses: Cc:

Description

Add test coverage for requests of a single User resource for authors of different post types. Including authors of post types registered as:

  • public = true, show_in_rest = true success without auth
  • public = true, show_in_rest = false fail without auth
  • public = false, show_in_rest = true success without auth
  • public = false, show_in_rest = false fail without auth

See #38878

Attachments (1)

39546.diff (17.2 KB) - added by jnylen0 4 months ago.
Test all the things

Download all attachments as: .zip

Change History (7)

#1 @rachelbaker
4 months ago

@jnylen0 I know you were working on this, can you pick-up this ticket?

#2 @rachelbaker
4 months ago

  • Owner set to jnylen0
  • Status changed from new to assigned

@jnylen0
4 months ago

Test all the things

#3 @jnylen0
4 months ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from 4.8 to 4.7.2
  • Status changed from assigned to accepted
  • Version set to 4.7

This should be good to go now. One of the older tests was failing during full test suite runs because of some missing self::delete_user calls in other tests, causing one of the tested users to be on the second page of results.

Moving to 4.7.2 - I'd like to get these tests in before we start work on multisite users.

#4 @dd32
3 months ago

Moving to 4.7.2 - I'd like to get these tests in before we start work on multisite users.

Since these are just tests, adding them to 4.7.x isn't a big issue, but also pointless as they'll not actually be "deployed" anywhere, and as you're targeting 4.8+ for the development effort, doesn't it make sense to just add new tests to trunk? It's far less work for everyone involved.

#5 @jnylen0
3 months ago

  • Milestone changed from 4.7.2 to 4.8

Right, that makes more sense than whatever I was thinking, thanks.

#6 @jnylen0
3 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 39913:

REST API: Improve test coverage of single user endpoint for public data.

Add test coverage for requests of a single user resource for authors of post types registered as:

  • public = true, show_in_rest = true: success without auth.
  • public = true, show_in_rest = false: fail without auth.
  • public = false, show_in_rest = true: success without auth.
  • public = false, show_in_rest = false: fail without auth.

See #38878.
Fixes #39546.

Note: See TracTickets for help on using tickets.