Search in sources :

Example 76 with PullRequest

use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.

the class PullRequestMapperTest method shouldMapPullRequestReviser.

@Test
void shouldMapPullRequestReviser() {
    PullRequest pullRequest = TestData.createPullRequest();
    pullRequest.setReviser("trillian");
    PullRequestDto dto = mapper.map(pullRequest, REPOSITORY);
    assertThat(dto.getReviser().getDisplayName()).isEqualTo("trillian");
}
Also used : PullRequest(com.cloudogu.scm.review.pullrequest.service.PullRequest) Test(org.junit.jupiter.api.Test)

Example 77 with PullRequest

use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.

the class PullRequestMapperTest method shouldMapPullRequestApprover.

@Test
void shouldMapPullRequestApprover() {
    PullRequest pullRequest = TestData.createPullRequest();
    pullRequest.addApprover("deletedUser");
    PullRequestDto dto = mapper.map(pullRequest, REPOSITORY);
    assertThat(dto.getReviewer()).extracting("id").containsExactly("deletedUser");
}
Also used : PullRequest(com.cloudogu.scm.review.pullrequest.service.PullRequest) Test(org.junit.jupiter.api.Test)

Example 78 with PullRequest

use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.

the class PullRequestMapperTest method shouldNotAddLinkForWorkflowResultIfPullRequestIsMerged.

@Test
void shouldNotAddLinkForWorkflowResultIfPullRequestIsMerged() {
    PullRequest pullRequest = TestData.createPullRequest();
    pullRequest.setStatus(PullRequestStatus.MERGED);
    PullRequestDto dto = mapper.map(pullRequest, REPOSITORY);
    assertThat(dto.getLinks().getLinkBy("workflowResult")).isEmpty();
}
Also used : PullRequest(com.cloudogu.scm.review.pullrequest.service.PullRequest) Test(org.junit.jupiter.api.Test)

Example 79 with PullRequest

use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.

the class MyOpenTasksTest method createPullRequest.

private static PullRequest createPullRequest(String id, PullRequestStatus status, String author) {
    PullRequest existingPullRequest = new PullRequest();
    existingPullRequest.setId(id);
    existingPullRequest.setTitle("title " + id);
    existingPullRequest.setSource("source");
    existingPullRequest.setTarget("target");
    existingPullRequest.setStatus(status);
    existingPullRequest.setAuthor(author);
    return existingPullRequest;
}
Also used : PullRequest(com.cloudogu.scm.review.pullrequest.service.PullRequest)

Example 80 with PullRequest

use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.

the class AllReviewerApprovedRuleTest method shouldReturnSuccess.

@Test
void shouldReturnSuccess() {
    PullRequest pullRequest = TestData.createPullRequest();
    pullRequest.addApprover("trillian");
    pullRequest.addApprover("dent");
    Context context = new Context(REPOSITORY, pullRequest);
    Result result = rule.validate(context);
    assertThat(result.isSuccess()).isTrue();
}
Also used : PullRequest(com.cloudogu.scm.review.pullrequest.service.PullRequest) Test(org.junit.jupiter.api.Test)

Aggregations

PullRequest (com.cloudogu.scm.review.pullrequest.service.PullRequest)82 Repository (sonia.scm.repository.Repository)27 Test (org.junit.jupiter.api.Test)20 Test (org.junit.Test)18 TestData.createPullRequest (com.cloudogu.scm.review.TestData.createPullRequest)17 MockHttpRequest (org.jboss.resteasy.mock.MockHttpRequest)16 Subscribe (com.github.legman.Subscribe)13 SubjectAware (com.github.sdorra.shiro.SubjectAware)13 NamespaceAndName (sonia.scm.repository.NamespaceAndName)13 User (sonia.scm.user.User)11 DisplayUser (sonia.scm.user.DisplayUser)10 JsonNode (com.fasterxml.jackson.databind.JsonNode)8 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)8 Optional (java.util.Optional)7 Comment (com.cloudogu.scm.review.comment.service.Comment)6 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)6 PermissionCheck (com.cloudogu.scm.review.PermissionCheck)5 PullRequestService (com.cloudogu.scm.review.pullrequest.service.PullRequestService)5 Operation (io.swagger.v3.oas.annotations.Operation)5 List (java.util.List)5