diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/zotapi.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/zotapi.rs b/tests/zotapi.rs index 3f889c5..37979fd 100644 --- a/tests/zotapi.rs +++ b/tests/zotapi.rs @@ -102,6 +102,26 @@ fn create_new_post_with_title() { } #[test] +fn upload_item_with_media_file() { + let m = mock("POST", "/api/z/1.0/item/update") + .match_header("authorization", Matcher::Regex(r"Basic \w+".into())) + .match_header("content-type", Matcher::Regex("^multipart/form-data; boundary=.+$".into())) + .with_status(200) + .with_header("content-type", "application/json") + .with_body("{}") + .create(); + + let z = zotapi::client(&format!("http://{}", mockito::SERVER_ADDRESS), "testuser", "test1234"); + let _res = z.item() + .title("A title") + .body("This is a test") + .file("testfile.jpg") + .create(); + + m.assert(); +} + +#[test] fn fetch_xchan_by_address() { let m = mock("GET", "/api/z/1.0/xchan?address=test%40test.com") .match_header("Authorization", Matcher::Regex(r"Basic \w+".into())) |