Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access token from identity provider #23

Merged
merged 14 commits into from
Jan 31, 2024
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ SOFTWARE.
<groupId>org.glassfish.grizzly</groupId>
<artifactId>grizzly-http-server</artifactId>
<version>${grizzly.version}</version>
dukris marked this conversation as resolved.
Show resolved Hide resolved
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@

package git.tracehub.pmo.platforms.github;

import com.jcabi.github.Collaborators;
import com.jcabi.github.Github;
import com.jcabi.github.Repo;
import com.jcabi.github.Repos;
import com.jcabi.github.mock.MkGithub;
import java.io.IOException;
import org.hamcrest.MatcherAssert;
import org.hamcrest.core.IsEqual;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

/**
* Test suite for {@link InviteCollaborator}.
Expand All @@ -34,17 +34,18 @@
final class InviteCollaboratorTest {

@Test
void invitesCollaboratorSuccessfully() {
final Github github = Mockito.mock(Github.class);
final Repos repos = Mockito.mock(Repos.class);
final Repo repo = Mockito.mock(Repo.class);
Mockito.when(github.repos()).thenReturn(repos);
Mockito.when(repos.get(Mockito.any())).thenReturn(repo);
Mockito.when(repo.collaborators()).thenReturn(Mockito.mock(Collaborators.class));
new InviteCollaborator("user/repo", "user", github).exec();
Mockito.verify(github, Mockito.times(1)).repos();
Mockito.verify(repos, Mockito.times(1)).get(Mockito.any());
Mockito.verify(repo, Mockito.times(1)).collaborators();
void invitesCollaboratorSuccessfully() throws IOException {
final String collaborator = "name";
final MkGithub github = new MkGithub("user");
final Repo repo = github.repos().create(
new Repos.RepoCreate("repo", false)
);
new InviteCollaborator("user/repo", collaborator, github).exec();
MatcherAssert.assertThat(
"Collaborator %s isn't invited".formatted(collaborator),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about Collaborator %s isn't invited as expected ?

repo.collaborators().isCollaborator(collaborator),
new IsEqual<>(true)
);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

/**
* Github Integration Tests.
* Github Platform Tests.
*
* @since 0.0.0
*/
Expand Down
Loading