Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSingaram Subramanian2018-02-25 22:26:43 +0000
committerThomas Wolf2018-05-30 12:44:45 +0000
commit74b4db841f41835ab96521d2bd93dee318b94000 (patch)
tree7b722fa4a4d77045d4819254b812428220ea915a /org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests
parent6fc1a5eacd8dbaf89e4b6e2e9b28d7da30c09e9d (diff)
downloadegit-github-74b4db841f41835ab96521d2bd93dee318b94000.tar.gz
egit-github-74b4db841f41835ab96521d2bd93dee318b94000.tar.xz
egit-github-74b4db841f41835ab96521d2bd93dee318b94000.zip
Get user's teams across GitHub organizations
User may belong to different teams in different GitHub organizations. This change is to retrieve all those teams across organizations using GitHub APIs. Bug: 529850 Change-Id: I703c3385e26ffcd4e34aa1aa1515f6e53fbdf008 Signed-off-by: Singaram Subramanian <to.ramsubramanian@gmail.com>
Diffstat (limited to 'org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests')
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/OrganizationTest.java50
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/TeamServiceTest.java17
2 files changed, 66 insertions, 1 deletions
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/OrganizationTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/OrganizationTest.java
new file mode 100644
index 00000000..5787f5aa
--- /dev/null
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/OrganizationTest.java
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * Copyright (c) 2018 Singaram Subramanian <to.ramsubramanian@gmail.com>
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Singaram Subramanian (Capital One) - (Bug: 529850)
+ * User teams across GitHub organizations implementation
+ *****************************************************************************/
+package org.eclipse.egit.github.core.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import org.eclipse.egit.github.core.Organization;
+import org.junit.Test;
+
+/**
+ * Unit tests of {@link Organization}
+ */
+public class OrganizationTest {
+
+ /**
+ * Test default state of organization
+ */
+ @Test
+ public void defaultState() {
+ Organization organization = new Organization();
+ assertEquals(0, organization.getId());
+ assertNull(organization.getLogin());
+ assertNull(organization.getDescription());
+ assertNull(organization.getUrl());
+ }
+
+ /**
+ * Test updating organization fields
+ */
+ @Test
+ public void updateFields() {
+ Organization organization = new Organization();
+ assertEquals(12, organization.setId(12).getId());
+ assertEquals("orgName", organization.setLogin("orgName").getLogin());
+ assertEquals("description", organization.setDescription("description").getDescription());
+ assertEquals("url", organization.setUrl("url").getUrl());
+ }
+}
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/TeamServiceTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/TeamServiceTest.java
index 06b53163..ea5c6044 100644
--- a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/TeamServiceTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/TeamServiceTest.java
@@ -1,5 +1,5 @@
/******************************************************************************
- * Copyright (c) 2011, 2015 GitHub Inc. and others
+ * Copyright (c) 2011, 2018 GitHub Inc. and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -11,6 +11,8 @@
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
* Michael Mathews (Arizona Board of Regents) - (Bug: 447419)
* Team Membership API implementation
+ * Singaram Subramanian (Capital One) - (Bug: 529850)
+ * User teams across GitHub organizations implementation
*****************************************************************************/
package org.eclipse.egit.github.core.tests;
@@ -422,4 +424,17 @@ public class TeamServiceTest {
request.setUri(Utils.page("/repos/o/n/teams"));
verify(client).get(request);
}
+
+ /**
+ * Get current user's teams across all GitHub organizations
+ *
+ * @throws IOException
+ */
+ @Test
+ public void getAllTeams() throws IOException {
+ service.getTeams();
+ GitHubRequest request = new GitHubRequest();
+ request.setUri(Utils.page("/user/teams"));
+ verify(client).get(request);
+ }
}

Back to the top