use of io.pivotal.cla.webdriver.pages.SignCclaPage in project pivotal-cla by pivotalsoftware.
the class CclaControllerTests method signTelephoneRequired.
@Test
public void signTelephoneRequired() throws Exception {
when(mockClaRepository.findByNameAndPrimaryTrue(cla.getName())).thenReturn(cla);
when(mockClaRepository.findOne(cla.getId())).thenReturn(cla);
when(mockGitHub.getOrganizations(anyString())).thenReturn(Arrays.asList("spring", "pivotal"));
SignCclaPage signPage = SignCclaPage.go(getDriver(), cla.getName());
Form form = signPage.form();
signPage = form.name("Rob Winch").email("rob@gmail.com").mailingAddress("123 Seasame St").country("USA").companyName("Pivotal").gitHubOrganization("pivotal").title("Director").confirm().sign(SignCclaPage.class);
signPage.assertAt();
form = signPage.form();
form.assertName().hasNoErrors();
form.assertEmail().hasNoErrors();
form.assertMailingAddress().hasNoErrors();
form.assertCountry().hasNoErrors();
form.assertTelephone().hasRequiredError();
form.assertConfirm().hasNoErrors();
}
use of io.pivotal.cla.webdriver.pages.SignCclaPage in project pivotal-cla by pivotalsoftware.
the class CclaControllerTests method signOrganizationRequired.
@Test
public void signOrganizationRequired() throws Exception {
when(mockClaRepository.findByNameAndPrimaryTrue(cla.getName())).thenReturn(cla);
when(mockClaRepository.findOne(cla.getId())).thenReturn(cla);
when(mockGitHub.getOrganizations(anyString())).thenReturn(Arrays.asList("spring", "pivotal"));
SignCclaPage signPage = SignCclaPage.go(getDriver(), cla.getName());
Form form = signPage.form();
signPage = form.name("Rob Winch").email("rob@gmail.com").mailingAddress("123 Seasame St").country("USA").telephone("123.456.7890").companyName("Pivotal").title("Director").confirm().sign(SignCclaPage.class);
signPage.assertAt();
form = signPage.form();
form.assertName().hasNoErrors();
form.assertEmail().hasNoErrors();
form.assertCompanyName().hasNoErrors();
form.assertGitHubOrganization().hasRequiredError();
form.assertConfirm().hasNoErrors();
}
use of io.pivotal.cla.webdriver.pages.SignCclaPage in project pivotal-cla by pivotalsoftware.
the class CclaControllerTests method signNoRepositoryIdWithPullRequestId.
@Test
public void signNoRepositoryIdWithPullRequestId() {
when(mockClaRepository.findByNameAndPrimaryTrue(cla.getName())).thenReturn(cla);
when(mockClaRepository.findOne(cla.getId())).thenReturn(cla);
SignCclaPage signPage = SignCclaPage.go(getDriver(), cla.getName(), "rwinch/176_test", 2);
signPage = signPage.form().name("Rob Winch").email("rob@gmail.com").sign(SignCclaPage.class);
signPage.assertAt();
}
use of io.pivotal.cla.webdriver.pages.SignCclaPage in project pivotal-cla by pivotalsoftware.
the class CclaControllerTests method signNameRequired.
@Test
public void signNameRequired() throws Exception {
when(mockClaRepository.findByNameAndPrimaryTrue(cla.getName())).thenReturn(cla);
when(mockClaRepository.findOne(cla.getId())).thenReturn(cla);
when(mockGitHub.getOrganizations(anyString())).thenReturn(Arrays.asList("spring", "pivotal"));
SignCclaPage signPage = SignCclaPage.go(getDriver(), cla.getName());
Form form = signPage.form();
signPage = form.email("rob@gmail.com").mailingAddress("123 Seasame St").country("USA").telephone("123.456.7890").companyName("Pivotal").gitHubOrganization("pivotal").title("Director").confirm().sign(SignCclaPage.class);
signPage.assertAt();
form = signPage.form();
form.assertName().hasRequiredError();
form.assertEmail().hasNoErrors();
form.assertCompanyName().hasNoErrors();
form.assertGitHubOrganization().hasNoErrors();
form.assertConfirm().hasNoErrors();
}
use of io.pivotal.cla.webdriver.pages.SignCclaPage in project pivotal-cla by pivotalsoftware.
the class CclaControllerTests method signWithRepositoryIdWithPullRequestId.
@Test
public void signWithRepositoryIdWithPullRequestId() throws Exception {
String repositoryId = "rwinch/176_test";
when(mockClaRepository.findByNameAndPrimaryTrue(cla.getName())).thenReturn(cla);
when(mockClaRepository.findOne(cla.getId())).thenReturn(cla);
when(mockGitHub.getOrganizations(anyString())).thenReturn(Arrays.asList("spring", "pivotal"));
when(mockGitHub.getShaForPullRequest(any(PullRequestStatus.class))).thenReturn("abc123");
when(mockCorporateSignatureRepository.findSignature(anyString(), anyCollectionOf(String.class), anyCollectionOf(String.class))).thenReturn(null, corporateSignature);
when(mockTokenRepo.findOne(repositoryId)).thenReturn(new AccessToken(repositoryId, "access-token-123"));
int pullRequestId = 2;
SignCclaPage signPage = SignCclaPage.go(getDriver(), cla.getName(), repositoryId, pullRequestId);
signPage = signPage.form().name("Rob Winch").email("rob@gmail.com").mailingAddress("123 Seasame St").country("USA").telephone("123.456.7890").companyName("Pivotal").gitHubOrganization("pivotal").title("Director").confirm().sign(SignCclaPage.class);
signPage.assertAt();
signPage.assertPullRequestLink(repositoryId, pullRequestId);
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(WithSigningUserFactory.create().getGitHubLogin());
assertThat(updatePr.getPullRequestId()).isEqualTo(pullRequestId);
assertThat(updatePr.getRepoId()).isEqualTo(repositoryId);
}
Aggregations