Skip to content

Commit b189438

Browse files
committed
Add url encoding related unit tests for plugins endpoint
1 parent aa73608 commit b189438

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

wp_api/src/endpoint/plugins_endpoint.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ mod tests {
7171
"classic-editor/classic-editor",
7272
"/plugins/classic-editor/classic-editor"
7373
)]
74+
#[case("foo/bar%baz", "/plugins/foo/bar%25baz")]
75+
#[case("foo/です", "/plugins/foo/%E3%81%A7%E3%81%99")]
7476
fn delete_plugin(
7577
plugins_endpoint: PluginsEndpoint,
7678
#[case] plugin_slug: &str,
@@ -103,6 +105,12 @@ mod tests {
103105
WPContext::Embed,
104106
"/plugins/classic-editor/classic-editor?context=embed"
105107
)]
108+
#[case("foo/bar%baz", WPContext::Edit, "/plugins/foo/bar%25baz?context=edit")]
109+
#[case(
110+
"foo/です",
111+
WPContext::View,
112+
"/plugins/foo/%E3%81%A7%E3%81%99?context=view"
113+
)]
106114
fn retrieve_plugin(
107115
plugins_endpoint: PluginsEndpoint,
108116
#[case] plugin_slug: &str,
@@ -121,6 +129,8 @@ mod tests {
121129
"classic-editor/classic-editor",
122130
"/plugins/classic-editor/classic-editor"
123131
)]
132+
#[case("foo/bar%baz", "/plugins/foo/bar%25baz")]
133+
#[case("foo/です", "/plugins/foo/%E3%81%A7%E3%81%99")]
124134
fn update_plugin(
125135
plugins_endpoint: PluginsEndpoint,
126136
#[case] plugin_slug: &str,

0 commit comments

Comments
 (0)