diff options
Diffstat (limited to 'tests/zotapi.rs')
-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())) |