From 1fd9f311a55759a613e4df66d462a34102644380 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Wed, 1 Jan 2020 20:19:01 +0100 Subject: Allow limiting a new item to one or more privacy groups. --- tests/zotapi.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'tests/zotapi.rs') diff --git a/tests/zotapi.rs b/tests/zotapi.rs index 4bac884..aa9756c 100644 --- a/tests/zotapi.rs +++ b/tests/zotapi.rs @@ -100,6 +100,34 @@ fn create_new_post_with_title() { m.assert(); } +#[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") -- cgit v1.2.3