aboutsummaryrefslogtreecommitdiffstats
path: root/tests/zotapi.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/zotapi.rs')
-rw-r--r--tests/zotapi.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/zotapi.rs b/tests/zotapi.rs
index 37979fd..3105240 100644
--- a/tests/zotapi.rs
+++ b/tests/zotapi.rs
@@ -104,8 +104,20 @@ 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("authorization", Matcher::Regex(r"Basic \w+=".into()))
.match_header("content-type", Matcher::Regex("^multipart/form-data; boundary=.+$".into()))
+ .match_body(Matcher::Regex(
+ "--.+\r\n".to_owned() +
+ "Content-Disposition: form-data; name=\"body\"\r\n" +
+ "\r\nThis is a test\r\n" +
+ "--.+\r\n" +
+ "Content-Disposition: form-data; name=\"title\"\r\n" +
+ "\r\nA title\r\n" +
+ "--.+\r\n" +
+ "Content-Disposition: form-data; name=\"files\"; filename=\"testfile.txt\"\r\n" +
+ "Content-Type: text/plain\r\n" +
+ "\r\ntestfile contents\n" +
+ "\r\n--.+--\r\n"))
.with_status(200)
.with_header("content-type", "application/json")
.with_body("{}")
@@ -115,7 +127,7 @@ fn upload_item_with_media_file() {
let _res = z.item()
.title("A title")
.body("This is a test")
- .file("testfile.jpg")
+ .file("tests/fixtures/testfile.txt")
.create();
m.assert();