Skip to content

Conversation

oguzkocer
Copy link
Contributor

@oguzkocer oguzkocer commented Jul 3, 2024

This PR builds on #155 to add the remaining endpoints for Application Passwords. It includes all the necessary unit and integration tests in Rust and a few integration tests in Kotlin. Since we are generating all the necessary implementations for an endpoint, there is very little implementation on the library side.

Here is a list of changes - some of which didn't need to happen in this PR, but they are very straightforward, so it shouldn't be difficult to review them:

  1. Generated test credentials now include the uuid for the application password which is used for validation in application password integration tests.
  2. Adds serial_test crate and marks immut & err tests as parallel; mut tests as serial. These markings ensure that all serial tests are run sequentially and no parallel tests are run while serial tests are being run. Any test that doesn't have a mark may run at any point - so these should be tests that won't get impacted by other conditions, such as the wp_contextual & wp_derive_request_builder tests. Technically login_immut tests wouldn't be impacted by other tests either, but I marked them as parallel as well for consistency. With this change, we no longer need to pass in --test-threads 1 argument while running cargo test.
  3. It adds a helper to run wp_cli commands. I ended up not needing it for this PR, but I intend to update some of the tests to use wp_cli instead of relying on DB queries.
  4. Updates expected_status_code_for_wp_rest_error_code integration test helper to return an array slice instead of a single status code. I was expecting to make this change at some point, and surprised that it took this long. There is no assigned status code for an error in WordPress source code, and under different conditions, different status codes might be reported for the same error.

To Test

  • make test-server && make dump-mysql && make backup-wp-content-plugins
  • cargo test
  • cd native/kotlin && ./gradlew :api:kotlin:integrationTest

@oguzkocer oguzkocer added this to the 0.1 milestone Jul 3, 2024
@oguzkocer oguzkocer requested a review from jkmassel July 3, 2024 21:29
@oguzkocer oguzkocer enabled auto-merge (squash) July 3, 2024 21:30
Copy link
Contributor

@jkmassel jkmassel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests work, and I implemented the Swift side of things which worked great in that example app

@oguzkocer oguzkocer merged commit 6c00212 into trunk Jul 4, 2024
@oguzkocer oguzkocer deleted the application-passwords-remaining branch July 4, 2024 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants