Skip to content

Login spec tests in Rust#666

Merged
oguzkocer merged 9 commits intotrunkfrom
login-spec-tests-in-rust
Apr 14, 2025
Merged

Login spec tests in Rust#666
oguzkocer merged 9 commits intotrunkfrom
login-spec-tests-in-rust

Conversation

@oguzkocer
Copy link
Contributor

@oguzkocer oguzkocer commented Apr 11, 2025

Uses #610 as a template to build on. Some of the tests in #610 were marked as TODO, in which case I followed the Kotlin test implementation.

The PR adds a flexible MockRequestExecutor implementation. It also adds some WpNetworkResponse helpers similar to the ones in Kotlin.

It removes the previous login tests since the spec tests cover the same basis.

@oguzkocer oguzkocer added this to the 0.2 milestone Apr 11, 2025
@oguzkocer oguzkocer requested a review from jkmassel April 11, 2025 20:22
@oguzkocer oguzkocer enabled auto-merge (squash) April 11, 2025 20:23
}
"http://localhost/wp-json" | "https://localhost/wp-json" => {
Ok(response_helpers::json_response_from_path(Path::new(
"../native/swift/Tests/wordpress-api/Resources/Responses/localhost-json-root.json",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Kotlin, Swift & Rust tests are using this path. We should move it to a common place, but I wanted to separate that into its own PR.

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.

Looks good – just one adjustment required

login_err("https://valid-looking-url-but-not-actually.foo")
.await
.to_find_api_root_failure(),
FindApiRootFailure::FetchHomepage { .. }
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be NonExistentSiteError

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be addressed in b19d26f.

Fixes issues with DNS resolution errors not being detected
@jkmassel jkmassel self-requested a review April 14, 2025 19:34
@oguzkocer oguzkocer merged commit 5fdd86d into trunk Apr 14, 2025
20 checks passed
@oguzkocer oguzkocer deleted the login-spec-tests-in-rust branch April 14, 2025 19:59
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