use of io.pivotal.cla.webdriver.pages.SignCclaPage in project pivotal-cla by pivotalsoftware.
the class CclaControllerTests method signCountryRequired.
@Test
public void signCountryRequired() 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").telephone("123.456.7890").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().hasRequiredError();
form.assertTelephone().hasNoErrors();
form.assertConfirm().hasNoErrors();
}
use of io.pivotal.cla.webdriver.pages.SignCclaPage in project pivotal-cla by pivotalsoftware.
the class CclaControllerTests method sign.
@Test
public void sign() throws Exception {
String organization = "pivotal";
String name = "Rob Winch";
String email = "rob@gmail.com";
String address = "123 Seasame St";
String country = "USA";
String telephone = "123.456.7890";
String companyName = "Pivotal";
String title = "Director";
when(mockClaRepository.findByNameAndPrimaryTrue(cla.getName())).thenReturn(cla);
when(mockClaRepository.findOne(cla.getId())).thenReturn(cla);
when(mockGitHub.getOrganizations(anyString())).thenReturn(Arrays.asList("spring", organization));
SignCclaPage signPage = SignCclaPage.go(getDriver(), cla.getName());
signPage = signPage.form().name(name).email(email).mailingAddress(address).country(country).telephone(telephone).companyName(companyName).gitHubOrganization(organization).title(title).confirm().sign(SignCclaPage.class);
signPage.assertAt();
ArgumentCaptor<CorporateSignature> signatureCaptor = ArgumentCaptor.forClass(CorporateSignature.class);
verify(mockCorporateSignatureRepository).save(signatureCaptor.capture());
CorporateSignature signature = signatureCaptor.getValue();
assertThat(signature.getCla()).isEqualTo(cla);
assertThat(signature.getCountry()).isEqualTo(country);
assertThat(signature.getName()).isEqualTo(name);
assertThat(signature.getEmail()).isEqualTo(email);
assertThat(signature.getMailingAddress()).isEqualTo(address);
assertThat(signature.getTelephone()).isEqualTo(telephone);
assertThat(signature.getCompanyName()).isEqualTo(companyName);
assertThat(signature.getGitHubOrganization()).isEqualTo(organization);
assertThat(signature.getTitle()).isEqualTo(title);
assertThat(signature.getDateOfSignature()).isCloseTo(new Date(), TimeUnit.SECONDS.toMillis(5));
verify(mockGitHub, never()).save(any(PullRequestStatus.class));
}
use of io.pivotal.cla.webdriver.pages.SignCclaPage 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();
}
use of io.pivotal.cla.webdriver.pages.SignCclaPage in project pivotal-cla by pivotalsoftware.
the class CclaControllerTests method signConfirmRequired.
@Test
public void signConfirmRequired() 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").gitHubOrganization("pivotal").title("Director").sign(SignCclaPage.class);
signPage.assertAt();
form = signPage.form();
form.assertName().hasNoErrors();
form.assertEmail().hasNoErrors();
form.assertMailingAddress().hasNoErrors();
form.assertCountry().hasNoErrors();
form.assertTelephone().hasNoErrors();
form.assertConfirm().hasRequiredError();
}
use of io.pivotal.cla.webdriver.pages.SignCclaPage in project pivotal-cla by pivotalsoftware.
the class CclaControllerTests method signNoRepositoryIdAndNoPullRequestId.
@Test
public void signNoRepositoryIdAndNoPullRequestId() 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());
signPage = signPage.form().name("Rob Winch").email("rob@gmail.com").sign(SignCclaPage.class);
signPage.assertAt();
}
Aggregations