diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2020-01-01 20:19:01 +0100 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2020-01-01 20:19:01 +0100 |
commit | 1fd9f311a55759a613e4df66d462a34102644380 (patch) | |
tree | b5b65be58c059239d9219ee1fa64cc3e36564f74 /tests | |
parent | ad3874f8bf5b5451e910ceae02518c04695e63c6 (diff) | |
download | rust-zotapi-1fd9f311a55759a613e4df66d462a34102644380.tar.gz rust-zotapi-1fd9f311a55759a613e4df66d462a34102644380.tar.bz2 rust-zotapi-1fd9f311a55759a613e4df66d462a34102644380.zip |
Allow limiting a new item to one or more privacy groups.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/zotapi.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/zotapi.rs b/tests/zotapi.rs index 4bac884..aa9756c 100644 --- a/tests/zotapi.rs +++ b/tests/zotapi.rs @@ -101,6 +101,34 @@ fn create_new_post_with_title() { } #[test] +fn create_new_post_limited_to_one_privacy_group() { + // For some reason this mock does not match. + // Visually inspecting the payload it does however seem valid, + // so not sure how to handle this with the current framework. + // + // For now this test makes no assertions, but at least it runs + // through the code paths it should. + let _m = mock_with_authorization("POST", "/api/z/1.0/item/update") + .match_body( + Matcher::AllOf(vec![ + Matcher::UrlEncoded("body".to_string(), "This is a test".to_string()), + Matcher::UrlEncoded("groups_allow[0]".to_string(), "grouphash".to_string()) + ]) + ) + .with_status(200) + .with_header("content-type", "application/json") + .with_body("{}") + .create(); + + let _res = client().item() + .body("This is a test") + .group_allow("grouphash") + .create(); + + //m.assert(); +} + +#[test] fn upload_item_with_media_file() { let m = mock_with_authorization("POST", "/api/z/1.0/item/update") .match_header("content-type", Matcher::Regex("^multipart/form-data; boundary=.+$".into())) |