From 8158bee4cbb5cc599c38788f0aa12a489e5261c1 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Mon, 10 Jun 2019 17:32:32 +0200 Subject: Implement fetching privacy group members. --- tests/zotapi.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'tests') 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(); +} -- cgit v1.2.3