diff options
author | mcmathews | 2014-11-03 21:33:39 +0000 |
---|---|---|
committer | Michael Mathews | 2015-03-09 23:20:20 +0000 |
commit | a4b06eb46a951c821ba69fdec48ec4c5196cb718 (patch) | |
tree | c680e210a1bda9445eedd19f885e433ebb0fafaf /org.eclipse.egit.github.core.tests | |
parent | eb83c17e47247e19c41aaba497f4c91d6e2a96c5 (diff) | |
download | egit-github-a4b06eb46a951c821ba69fdec48ec4c5196cb718.tar.gz egit-github-a4b06eb46a951c821ba69fdec48ec4c5196cb718.tar.xz egit-github-a4b06eb46a951c821ba69fdec48ec4c5196cb718.zip |
Implemented the GitHub Team Membership API
Github recently rolled out the Team Membership API,
and subsequently deprecated the Team Members API.
Currently, using the Team Members API to add a member
to a team who is not already part of the org, will result
in an error.
The changes made are to implement the new Team
Memberships API.
Bug: 447419
Change-Id: I6773e31113688ac027cf8b061107f54a35ab10ff
Signed-off-by: Michael Mathews <mcmathe1@asu.edu>
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/TeamServiceTest.java | 55 |
1 files changed, 54 insertions, 1 deletions
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 10b7c7f0..737c4742 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 GitHub Inc. + * Copyright (c) 2011, 2015 GitHub Inc. and others * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,8 @@ * * Contributors: * Kevin Sawicki (GitHub Inc.) - initial API and implementation + * Michael Mathews (Arizona Board of Regents) - (Bug: 447419) + * Team Membership API implementation *****************************************************************************/ package org.eclipse.egit.github.core.tests; @@ -21,6 +23,7 @@ import java.util.Collections; import org.eclipse.egit.github.core.RepositoryId; import org.eclipse.egit.github.core.Team; +import org.eclipse.egit.github.core.TeamMembership; import org.eclipse.egit.github.core.client.GitHubClient; import org.eclipse.egit.github.core.client.GitHubRequest; import org.eclipse.egit.github.core.client.GitHubResponse; @@ -296,6 +299,56 @@ public class TeamServiceTest { service.removeMember(3, ""); } + @Test(expected = IllegalArgumentException.class) + public void getMembershipNullName() throws IOException { + service.getMembership(6, null); + } + + @Test(expected = IllegalArgumentException.class) + public void getMembershipEmptyName() throws IOException { + service.getMembership(6, ""); + } + + @Test + public void getMembership() throws IOException { + service.getMembership(6, "tt"); + GitHubRequest request = new GitHubRequest(); + request.setUri("/teams/6/memberships/tt"); + verify(client).get(request); + } + + @Test(expected = IllegalArgumentException.class) + public void addMembershipNullName() throws IOException { + service.addMembership(6, null); + } + + @Test(expected = IllegalArgumentException.class) + public void addMembershipEmptyName() throws IOException { + service.addMembership(6, ""); + } + + @Test + public void addMembership() throws IOException { + service.addMembership(6, "tt"); + verify(client).put("/teams/6/memberships/tt", null, TeamMembership.class); + } + + @Test(expected = IllegalArgumentException.class) + public void removeMembershipNullName() throws IOException { + service.removeMembership(6, null); + } + + @Test(expected = IllegalArgumentException.class) + public void removeMembershipEmptyName() throws IOException { + service.removeMembership(6, ""); + } + + @Test + public void removeMembership() throws IOException { + service.removeMembership(6, "tt"); + verify(client).delete("/teams/6/memberships/tt"); + } + /** * Remove member * |