Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.egit.github.core.tests/src')
-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