aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2019-06-10 17:32:32 +0200
committerHarald Eilertsen <haraldei@anduin.net>2019-06-10 17:32:32 +0200
commit8158bee4cbb5cc599c38788f0aa12a489e5261c1 (patch)
tree30f669dbd06b7977c29febc524dc5dbc7aa2cfbb /tests
parent39bef981a13701aaca944e50c5354487d528d977 (diff)
downloadrust-zotapi-8158bee4cbb5cc599c38788f0aa12a489e5261c1.tar.gz
rust-zotapi-8158bee4cbb5cc599c38788f0aa12a489e5261c1.tar.bz2
rust-zotapi-8158bee4cbb5cc599c38788f0aa12a489e5261c1.zip
Implement fetching privacy group members.
Diffstat (limited to 'tests')
-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();
+}