aboutsummaryrefslogtreecommitdiffstats
path: root/tests/zotapi.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/zotapi.rs')
-rw-r--r--tests/zotapi.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/zotapi.rs b/tests/zotapi.rs
index ef58171..81210db 100644
--- a/tests/zotapi.rs
+++ b/tests/zotapi.rs
@@ -114,3 +114,31 @@ fn fetch_xchan_by_address() {
let _res = z.xchan().by_address("test@test.com").fetch().unwrap();
m.assert();
}
+
+#[test]
+fn fetch_xchan_by_hash() {
+ let m = mock("GET", "/api/z/1.0/xchan?hash=baffebaff")
+ .match_header("Authorization", Matcher::Regex(r"Basic \w+".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.xchan().by_hash("baffebaff").fetch().unwrap();
+ m.assert();
+}
+
+#[test]
+fn fetch_xchan_by_guid() {
+ let m = mock("GET", "/api/z/1.0/xchan?guid=baffebaff-baff-baff")
+ .match_header("Authorization", Matcher::Regex(r"Basic \w+".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.xchan().by_guid("baffebaff-baff-baff").fetch().unwrap();
+ m.assert();
+}