Search in sources :

Example 1 with SignClaPage

use of io.pivotal.cla.webdriver.pages.SignClaPage in project pivotal-cla by pivotalsoftware.

the class ClaControllerTests method learnMoreLink.

@Test
@WithSigningUser
public void learnMoreLink() {
    SignClaPage home = SignClaPage.go(driver, cla.getName());
    AboutPage aboutPage = home.learnMore();
    aboutPage.assertAt();
}
Also used : SignClaPage(io.pivotal.cla.webdriver.pages.SignClaPage) AboutPage(io.pivotal.cla.webdriver.pages.AboutPage) WithSigningUser(io.pivotal.cla.security.WithSigningUser) Test(org.junit.Test)

Example 2 with SignClaPage

use of io.pivotal.cla.webdriver.pages.SignClaPage in project pivotal-cla by pivotalsoftware.

the class ClaControllerTests method claPivotalSignedWithPullRequest.

@Test
public void claPivotalSignedWithPullRequest() throws Exception {
    when(mockIndividualSignatureRepository.findSignaturesFor(any(), eq(WithSigningUserFactory.create()), eq(cla.getName()))).thenReturn(Arrays.asList(individualSignature));
    String repositoryId = "spring-projects/spring-security";
    int pullRequestId = 123;
    SignClaPage home = SignClaPage.go(driver, cla.getName(), repositoryId, pullRequestId);
    home.assertAt();
    home.assertPullRequestLink(repositoryId, pullRequestId);
}
Also used : SignClaPage(io.pivotal.cla.webdriver.pages.SignClaPage) Test(org.junit.Test)

Example 3 with SignClaPage

use of io.pivotal.cla.webdriver.pages.SignClaPage in project pivotal-cla by pivotalsoftware.

the class ClaControllerTests method claPivotalWithPullRequest.

@Test
public void claPivotalWithPullRequest() throws Exception {
    String repositoryId = "spring-projects/spring-security";
    int pullRequestId = 123;
    SignClaPage home = SignClaPage.go(driver, cla.getName(), repositoryId, pullRequestId);
    home.assertAt();
    home.assertClaLinksWithPullRequest(cla.getName(), repositoryId, pullRequestId);
    verify(mockGitHub, never()).save(any(PullRequestStatus.class));
}
Also used : SignClaPage(io.pivotal.cla.webdriver.pages.SignClaPage) PullRequestStatus(io.pivotal.cla.service.github.PullRequestStatus) Test(org.junit.Test)

Example 4 with SignClaPage

use of io.pivotal.cla.webdriver.pages.SignClaPage in project pivotal-cla by pivotalsoftware.

the class ClaControllerTests method viewSignedWithRepositoryIdAndPullRequestIdNewUser.

@Test
@WithAnonymousUser
public void viewSignedWithRepositoryIdAndPullRequestIdNewUser() throws Exception {
    String repositoryId = "spring-projects/spring-security";
    User signingUser = WithSigningUserFactory.create();
    when(mockGitHub.getCurrentUser(any())).thenReturn(signingUser);
    when(mockGitHub.getShaForPullRequest(any(PullRequestStatus.class))).thenReturn("abc123");
    when(mockIndividualSignatureRepository.findSignaturesFor(any(), eq(signingUser), eq(cla.getName()))).thenReturn(Arrays.asList(individualSignature));
    when(mockIndividualSignatureRepository.findSignaturesFor(any(), eq(signingUser))).thenReturn(Arrays.asList(individualSignature));
    when(mockTokenRepo.findOne(repositoryId)).thenReturn(new AccessToken(repositoryId, "access-token-123"));
    int pullRequestId = 123;
    SignClaPage home = SignClaPage.go(driver, cla.getName(), repositoryId, pullRequestId);
    home.assertAt();
    home.assertClaLinksWithPullRequest(cla.getName(), repositoryId, pullRequestId);
    home.assertPullRequestLink(repositoryId, pullRequestId);
    home.assertImported();
    ArgumentCaptor<PullRequestStatus> updatePullRequestCaptor = ArgumentCaptor.forClass(PullRequestStatus.class);
    verify(mockGitHub).save(updatePullRequestCaptor.capture());
    PullRequestStatus updatePr = updatePullRequestCaptor.getValue();
    String commitStatusUrl = "http://localhost/sign/" + cla.getName() + "?repositoryId=" + repositoryId + "&pullRequestId=" + pullRequestId;
    assertThat(updatePr.getUrl()).isEqualTo(commitStatusUrl);
    assertThat(updatePr.getGitHubUsername()).isEqualTo(signingUser.getGitHubLogin());
    assertThat(updatePr.getPullRequestId()).isEqualTo(pullRequestId);
    assertThat(updatePr.getRepoId()).isEqualTo(repositoryId);
}
Also used : SignClaPage(io.pivotal.cla.webdriver.pages.SignClaPage) WithSigningUser(io.pivotal.cla.security.WithSigningUser) User(io.pivotal.cla.data.User) WithAnonymousUser(org.springframework.security.test.context.support.WithAnonymousUser) AccessToken(io.pivotal.cla.data.AccessToken) PullRequestStatus(io.pivotal.cla.service.github.PullRequestStatus) WithAnonymousUser(org.springframework.security.test.context.support.WithAnonymousUser) Test(org.junit.Test)

Example 5 with SignClaPage

use of io.pivotal.cla.webdriver.pages.SignClaPage in project pivotal-cla by pivotalsoftware.

the class HomeControllerTests method signCcla.

@Test
@WithSigningUser
public void signCcla() {
    when(mockClaRepository.findByNameAndPrimaryTrue(cla.getName())).thenReturn(cla);
    SignClaPage home = HomePage.go(driver);
    SignCclaPage sign = home.signCcla(SignCclaPage.class);
    sign.assertAt();
}
Also used : SignClaPage(io.pivotal.cla.webdriver.pages.SignClaPage) SignCclaPage(io.pivotal.cla.webdriver.pages.SignCclaPage) WithSigningUser(io.pivotal.cla.security.WithSigningUser) Test(org.junit.Test)

Aggregations

SignClaPage (io.pivotal.cla.webdriver.pages.SignClaPage)18 Test (org.junit.Test)18 WithSigningUser (io.pivotal.cla.security.WithSigningUser)12 User (io.pivotal.cla.data.User)4 SignIclaPage (io.pivotal.cla.webdriver.pages.SignIclaPage)3 CurrentUserRequest (io.pivotal.cla.service.github.CurrentUserRequest)2 PullRequestStatus (io.pivotal.cla.service.github.PullRequestStatus)2 AboutPage (io.pivotal.cla.webdriver.pages.AboutPage)2 SignCclaPage (io.pivotal.cla.webdriver.pages.SignCclaPage)2 AdminLinkClaPage (io.pivotal.cla.webdriver.pages.admin.AdminLinkClaPage)2 WithAnonymousUser (org.springframework.security.test.context.support.WithAnonymousUser)2 AccessToken (io.pivotal.cla.data.AccessToken)1 OAuthAccessTokenParams (io.pivotal.cla.service.github.OAuthAccessTokenParams)1 GitHubLoginPage (io.pivotal.cla.webdriver.pages.github.GitHubLoginPage)1 GitHubPullRequestPage (io.pivotal.cla.webdriver.pages.github.GitHubPullRequestPage)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1