Examples of GHUser


Examples of org.kohsuke.github.GHUser

    private GhprbRepository repo;

    @Test
    public void testConstructorWhenAuthorIsWhitelisted() throws IOException {
        // GIVEN
        GHUser ghUser = mock(GHUser.class);
        GHCommitPointer head = mock(GHCommitPointer.class);
        GHCommitPointer base = mock(GHCommitPointer.class);
        given(head.getSha()).willReturn("some sha");
        given(base.getRef()).willReturn("some ref");

        // Mocks for GHPullRequest
        given(pr.getNumber()).willReturn(10);
        given(pr.getUpdatedAt()).willReturn(new Date());
        given(pr.getTitle()).willReturn("title");
        given(pr.getHead()).willReturn(head);
        given(pr.getBase()).willReturn(base);
        given(pr.getUser()).willReturn(ghUser);
        given(ghUser.getEmail()).willReturn("email");

        // Mocks for GhprbRepository
        given(repo.getName()).willReturn("repoName");

        // Mocks for Ghprb
View Full Code Here

Examples of org.kohsuke.github.GHUser

    }

    @Test
    public void testInitRepoNameNull() throws IOException {
        // GIVEN
        GHUser ghUser = mock(GHUser.class);
        GHCommitPointer head = mock(GHCommitPointer.class);
        GHCommitPointer base = mock(GHCommitPointer.class);

        // Mocks for GHPullRequest
        given(pr.getNumber()).willReturn(10);
        given(pr.getUpdatedAt()).willReturn(new Date());
        given(pr.getTitle()).willReturn("title");
        given(pr.getHead()).willReturn(head);
        given(pr.getBase()).willReturn(base);
        given(head.getSha()).willReturn("some sha");
        given(base.getRef()).willReturn("some ref");
        given(pr.getUser()).willReturn(ghUser);
        given(ghUser.getEmail()).willReturn("email");

        // Mocks for GhprbRepository
        given(repo.getName()).willReturn(null);
        doNothing().when(repo).addComment(eq(10), anyString());
View Full Code Here

Examples of org.kohsuke.github.GHUser

    }

    @Test
    public void testInitRepoNameNotNull() throws IOException {
        // GIVEN
        GHUser ghUser = mock(GHUser.class);
        GHCommitPointer head = mock(GHCommitPointer.class);
        GHCommitPointer base = mock(GHCommitPointer.class);

        // Mocks for GHPullRequest
        given(pr.getNumber()).willReturn(10);
        given(pr.getUpdatedAt()).willReturn(new Date());
        given(pr.getTitle()).willReturn("title");
        given(pr.getHead()).willReturn(head);
        given(pr.getBase()).willReturn(base);
        given(head.getSha()).willReturn("some sha");
        given(base.getRef()).willReturn("some ref");
        given(pr.getUser()).willReturn(ghUser);
        given(ghUser.getEmail()).willReturn("email");

        // Mocks for GhprbRepository
        given(repo.getName()).willReturn("name");
        doNothing().when(repo).addComment(eq(10), anyString());
View Full Code Here

Examples of org.kohsuke.github.GHUser

        }
        return true;
    }

    private void checkComment(GHIssueComment comment) throws IOException {
        GHUser sender = comment.getUser();
        String body = comment.getBody();

        // ignore comments from bot user, this fixes an issue where the bot would auto-whitelist
        // a user or trigger a build when the 'request for testing' phrase contains the
        // whitelist/trigger phrase and the bot is a member of a whitelisted organisation
View Full Code Here

Examples of org.kohsuke.github.GHUser

        commentOnRequest("Pull request is not mergeable.");
      return false;
    }
   
   
    GHUser triggerSender = cause.getTriggerSender();
   
    // ignore comments from bot user, this fixes an issue where the bot would auto-merge
    // a PR when the 'request for testing' phrase contains the PR merge trigger phrase and
    // the bot is a member of a whitelisted organisation
    if (helper.isBotUser(triggerSender)) {
      logger.println("Comment from bot user " + triggerSender.getLogin() + " ignored.");
      return false;
    }
 
    boolean merge = true;
   

    if (isOnlyAdminsMerge() && !helper.isAdmin(triggerSender)){
      merge = false;
      logger.println("Only admins can merge this pull request, " + triggerSender.getLogin() + " is not an admin.");
        commentOnRequest(
            String.format("Code not merged because %s is not in the Admin list.",
                    triggerSender.getName()));
    }
   
    if (isOnlyTriggerPhrase() && !helper.isTriggerPhrase(cause.getCommentBody())) {
      merge = false;
      logger.println("The comment does not contain the required trigger phrase.");

        commentOnRequest(
            String.format("Please comment with '%s' to automerge this request",
                  trigger.getTriggerPhrase()));
    }
   
      if (isDisallowOwnCode() && isOwnCode(pr, triggerSender)) {
      merge = false;
      logger.println("The commentor is also one of the contributors.");
        commentOnRequest(
            String.format("Code not merged because %s has committed code in the request.",
                  triggerSender.getName()));
      }
     
      if (merge) {
        logger.println("Merging the pull request");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.