Skip to content

Commit

Permalink
Move wordpress_org_api code into wp_api (#441)
Browse files Browse the repository at this point in the history
* Move wordpress_org_api code into wp_api

* Update plugin directory integration tests command
  • Loading branch information
crazytonyli authored Dec 12, 2024
1 parent a648cfd commit a452263
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 18 deletions.
11 changes: 0 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ members = [
"wp_derive_request_builder",
"wp_serde_helper",
"wp_uniffi_bindgen",
"wordpress_org_api",
"xcframework",
]
resolver = "2"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ test-rust-integration:
docker exec -i wordpress /bin/bash < ./scripts/run-rust-integration-tests.sh

test-rust-integration-wordpress-org-api:
$(rust_docker_run) cargo test --package wordpress_org_api -- --nocapture
$(rust_docker_run) cargo test --package wp_api_integration_tests --test test_plugin_directory -- --nocapture

test-kotlin-integration:
@# Help: Run Kotlin integration tests in test server.
Expand Down
1 change: 1 addition & 0 deletions wp_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub mod request;
pub mod site_settings;
pub mod url_query;
pub mod users;
pub mod wordpress_org;
pub mod wp_site_health_tests;

#[cfg(test)]
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions wp_api/src/wordpress_org/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mod de;
pub mod plugin_directory;
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use serde::Deserialize;

use std::{collections::HashMap, fmt::Debug};

use crate::de::deserialize_default_values;
use super::de::deserialize_default_values;

#[derive(Deserialize, Debug)]
pub struct PluginInformation {
Expand Down Expand Up @@ -166,13 +166,15 @@ mod tests {

#[fixture]
fn plugin_with_variant_types() -> Plugin {
let json_string = include_str!("../tests/plugin-with-different-types-of-values.json");
let json_string =
include_str!("../../tests/plugin-directory/plugin-with-different-types-of-values.json");
Plugin::parse(json_string)
}

#[fixture]
fn plugin_with_expected_types() -> Plugin {
let json_string = include_str!("../tests/plugin-with-expected-types.json");
let json_string =
include_str!("../../tests/plugin-directory/plugin-with-expected-types.json");
Plugin::parse(json_string)
}

Expand Down Expand Up @@ -318,7 +320,7 @@ mod tests {

#[test]
fn test_plugin_query_result() {
let json_string = include_str!("../tests/plugin-query-result.json");
let json_string = include_str!("../../tests/plugin-directory/plugin-query-result.json");
let parsed = serde_json::from_str::<QueryPluginResponse>(json_string);
assert!(parsed.is_ok(), "Failed to parse JSON: {:?}", parsed.err());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{
io::{self, Write},
};

use wordpress_org_api::plugin_directory::*;
use wp_api::wordpress_org::plugin_directory::*;

async fn query_plugins_slugs(url: &str) -> Result<Vec<String>, reqwest::Error> {
reqwest::get(url)
Expand Down

0 comments on commit a452263

Please sign in to comment.