Skip to content

Conversation

oguzkocer
Copy link
Contributor

Kotlin wrapper's WpRequestExecutor wasn't including the request method and body from WpNetworkRequest. This PR addresses that and adds integration tests for plugins endpoint.

To Test

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

Validate post requests are working in Kotlin

Creating/updating/deleting are mutating actions, so their tests can't currently be included in the Kotlin integration test suite - because we can't yet reset the server state from our Kotlin test executor. Since this PR requires mutating actions to validate its changes, you can manually run the test below.

Don't forget to reset your test server once you run this test, as the rest of the test suite will start failing once it's complete. The best way to ensure you have a clean test suite is to delete the Docker container and the .wordpress folder from the root directory of the project.

// native/kotlin/api/kotlin/src/integrationTest/kotlin/PluginsEndpointTest.kt

@Test
fun createPlugin() = runTest {
    val result = client.request { requestBuilder ->
        requestBuilder.plugins().create(
            params = PluginCreateParams(
                slug = PluginWpOrgDirectorySlug(WP_ORG_PLUGIN_SLUG_CLASSIC_WIDGETS),
                status = PluginStatus.ACTIVE
            )
        )
    }
    assert(result is WpRequestSuccess)
}

@oguzkocer oguzkocer added this to the 0.1 milestone Jul 5, 2024
@oguzkocer oguzkocer requested a review from jkmassel July 5, 2024 20:53
@oguzkocer oguzkocer enabled auto-merge (squash) July 5, 2024 20:54
@oguzkocer oguzkocer force-pushed the plugins-kotlin-integration-tests branch from b1f7705 to 7054392 Compare July 5, 2024 20:55
@oguzkocer oguzkocer merged commit c815ebc into trunk Jul 5, 2024
@oguzkocer oguzkocer deleted the plugins-kotlin-integration-tests branch July 5, 2024 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants