aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/zotapi.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/zotapi.rs b/tests/zotapi.rs
index 90f5298..f8991f7 100644
--- a/tests/zotapi.rs
+++ b/tests/zotapi.rs
@@ -63,3 +63,19 @@ fn return_error_if_invalid_auth_provided() {
assert!(data.is_err());
assert_eq!(format!("{:?}", data), "Err(Unauthorized)");
}
+
+#[test]
+fn create_new_post() {
+ let m = mock("POST", "/api/z/1.0/item/update")
+ .match_header("Authorization", Matcher::Regex(r"Basic \w+".into()))
+ .match_body("body=This+is+a+test")
+ .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.create_item("This is a test");
+
+ m.assert();
+}