|
28 | 28 | import static com.spotify.github.v3.clients.GitHubClient.LIST_FOLDERCONTENT_TYPE_REFERENCE;
|
29 | 29 | import static com.spotify.github.v3.clients.GitHubClient.LIST_PR_TYPE_REFERENCE;
|
30 | 30 | import static com.spotify.github.v3.clients.GitHubClient.LIST_REPOSITORY;
|
| 31 | +import static com.spotify.github.v3.clients.GitHubClient.LIST_REPOSITORY_INVITATION; |
31 | 32 | import static com.spotify.github.v3.clients.MockHelper.createMockResponse;
|
32 | 33 | import static com.spotify.github.v3.clients.RepositoryClient.STATUS_URI_TEMPLATE;
|
33 | 34 | import static java.lang.String.format;
|
@@ -207,6 +208,33 @@ public void removeCollaborator() throws Exception {
|
207 | 208 | assertThat(capture.getValue(), is("/repos/someowner/somerepo/collaborators/user"));
|
208 | 209 | }
|
209 | 210 |
|
| 211 | + @Test |
| 212 | + public void removeInvite() throws Exception { |
| 213 | + CompletableFuture<Response> response = completedFuture(mock(Response.class)); |
| 214 | + final ArgumentCaptor<String> capture = ArgumentCaptor.forClass(String.class); |
| 215 | + when(github.delete(capture.capture())).thenReturn(response); |
| 216 | + |
| 217 | + CompletableFuture<Void> deleteResponse = repoClient.removeInvite("invitation1"); |
| 218 | + deleteResponse.get(); |
| 219 | + |
| 220 | + assertThat(capture.getValue(), is("/repos/someowner/somerepo/invitations/invitation1")); |
| 221 | + } |
| 222 | + |
| 223 | + @Test |
| 224 | + public void listInvites() throws Exception { |
| 225 | + final CompletableFuture<List<RepositoryInvitation>> fixture = |
| 226 | + completedFuture( |
| 227 | + json.fromJson("[" + getFixture("repository_invitation.json") + "]", LIST_REPOSITORY_INVITATION)); |
| 228 | + when(github.request("/repos/someowner/somerepo/invitations", LIST_REPOSITORY_INVITATION)) |
| 229 | + .thenReturn(fixture); |
| 230 | + |
| 231 | + final List<RepositoryInvitation> invitations = repoClient.listInvitations().get(); |
| 232 | + assertThat(invitations.size(), is(1)); |
| 233 | + assertThat(invitations.get(0).repository().name(), is("Hello-World")); |
| 234 | + assertThat( |
| 235 | + invitations.get(0).inviter().login(), is("octocat")); |
| 236 | + } |
| 237 | + |
210 | 238 | @Test
|
211 | 239 | public void listCommits() throws Exception {
|
212 | 240 | final CompletableFuture<List<CommitItem>> fixture =
|
|
0 commit comments