Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Link2015-12-02 03:06:01 -0500
committerAlexander Link2015-12-02 03:25:38 -0500
commitfbe6fc5d13d51fddf8c6bc504559932fb7dfecca (patch)
tree72a248bd270f32f35f5037fa0964a4775d7a3e45 /org.eclipse.egit.github.core.tests
parente8c4ad3431b99f086f8ea1d8253ccd0323b9c7ba (diff)
downloadegit-github-fbe6fc5d13d51fddf8c6bc504559932fb7dfecca.tar.gz
egit-github-fbe6fc5d13d51fddf8c6bc504559932fb7dfecca.tar.xz
egit-github-fbe6fc5d13d51fddf8c6bc504559932fb7dfecca.zip
Enable getting owners of an organization
Until now the egit API did not provide a way to get the Organization owners. Using the GitHub API route /orgs/:org/members?role=<role> with "role" filter it is possible to get all members with a specific role. See https://developer.github.com/v3/orgs/members/#members-list for more information. Change-Id: Ida0bef8335f8d09b5650d3c26d960c0964e8a362 Signed-off-by: Alexander Link <Alexander.Link@sap.com>
Diffstat (limited to 'org.eclipse.egit.github.core.tests')
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/OrganizationServiceTest.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/OrganizationServiceTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/OrganizationServiceTest.java
index 2d9ec924..a745bb69 100644
--- a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/OrganizationServiceTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/OrganizationServiceTest.java
@@ -16,12 +16,14 @@ import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.verify;
import java.io.IOException;
+import java.util.HashMap;
import org.eclipse.egit.github.core.User;
import org.eclipse.egit.github.core.client.GitHubClient;
import org.eclipse.egit.github.core.client.GitHubRequest;
import org.eclipse.egit.github.core.client.GitHubResponse;
import org.eclipse.egit.github.core.service.OrganizationService;
+import org.eclipse.egit.github.core.service.OrganizationService.RoleFilter;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -216,6 +218,46 @@ public class OrganizationServiceTest {
}
/**
+ * Get members with role filter "all"
+ *
+ * @throws IOException
+ */
+ @Test
+ public void getMembersAll() throws IOException {
+ testMembersByRole(RoleFilter.all);
+ }
+
+ /**
+ * Get members with role filter "all"
+ *
+ * @throws IOException
+ */
+ @Test
+ public void getMembersAdmin() throws IOException {
+ testMembersByRole(RoleFilter.admin);
+ }
+
+ /**
+ * Get members with role filter "all"
+ *
+ * @throws IOException
+ */
+ @Test
+ public void getMembersMember() throws IOException {
+ testMembersByRole(RoleFilter.member);
+ }
+
+ private void testMembersByRole(RoleFilter roleFilter) throws IOException {
+ service.getMembers("group", roleFilter);
+ HashMap<String, String> params = new HashMap<String, String>();
+ params.put("role", roleFilter.toString());
+ GitHubRequest request = new GitHubRequest();
+ request.setParams(params);
+ request.setUri(Utils.page("/orgs/group/members?role=" + roleFilter.toString()));
+ verify(client).get(request);
+ }
+
+ /**
* Get public members with null name
*
* @throws IOException

Back to the top