diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2018-11-19 00:26:38 +0100 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2018-11-19 00:26:38 +0100 |
commit | 8294f640abc38611007cdc2697e5117b6c1663b9 (patch) | |
tree | 88052311550567460329862daa110b518d60bec8 /tests | |
parent | 23286103c0d3a1f9b49432da2b2bb2eadc022243 (diff) | |
download | rust-zotapi-8294f640abc38611007cdc2697e5117b6c1663b9.tar.gz rust-zotapi-8294f640abc38611007cdc2697e5117b6c1663b9.tar.bz2 rust-zotapi-8294f640abc38611007cdc2697e5117b6c1663b9.zip |
Begin multipart/form-data upload support.
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())) |