aboutsummaryrefslogtreecommitdiffstats
path: root/tests/zotapi.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/zotapi.rs')
-rw-r--r--tests/zotapi.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/zotapi.rs b/tests/zotapi.rs
index 7d10c6b..9ad5cf9 100644
--- a/tests/zotapi.rs
+++ b/tests/zotapi.rs
@@ -253,3 +253,33 @@ fn fetch_privacy_groups() {
let _res = z.group().fetch().unwrap();
m.assert();
}
+
+#[test]
+fn fetch_members_of_group_by_group_id() {
+ let m = mock("GET", Matcher::Regex(
+ r"^/api/z/1.0/group_members\?([^&]*&)*group_id=42".into()))
+ .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.group_members().by_group_id(42).fetch().unwrap();
+ m.assert();
+}
+
+#[test]
+fn fetch_members_of_group_by_group_name() {
+ let m = mock("GET", Matcher::Regex(
+ r"^/api/z/1.0/group_members\?([^&]*&)*group_name=Friends\+of\+pain".into()))
+ .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.group_members().by_group_name("Friends of pain").fetch().unwrap();
+ m.assert();
+}