Search in sources :

Example 6 with SignCclaPage

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();
}
Also used : Form(io.pivotal.cla.webdriver.pages.SignCclaPage.Form) SignCclaPage(io.pivotal.cla.webdriver.pages.SignCclaPage) Test(org.junit.Test)

Example 7 with SignCclaPage

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));
}
Also used : CorporateSignature(io.pivotal.cla.data.CorporateSignature) SignCclaPage(io.pivotal.cla.webdriver.pages.SignCclaPage) Matchers.anyString(org.mockito.Matchers.anyString) PullRequestStatus(io.pivotal.cla.service.github.PullRequestStatus) Date(java.util.Date) Test(org.junit.Test)

Example 8 with SignCclaPage

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();
}
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)

Example 9 with SignCclaPage

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();
}
Also used : Form(io.pivotal.cla.webdriver.pages.SignCclaPage.Form) SignCclaPage(io.pivotal.cla.webdriver.pages.SignCclaPage) Test(org.junit.Test)

Example 10 with SignCclaPage

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();
}
Also used : SignCclaPage(io.pivotal.cla.webdriver.pages.SignCclaPage) Test(org.junit.Test)

Aggregations

SignCclaPage (io.pivotal.cla.webdriver.pages.SignCclaPage)19 Test (org.junit.Test)19 Form (io.pivotal.cla.webdriver.pages.SignCclaPage.Form)9 WithSigningUser (io.pivotal.cla.security.WithSigningUser)3 Matchers.anyString (org.mockito.Matchers.anyString)3 ContributorLicenseAgreement (io.pivotal.cla.data.ContributorLicenseAgreement)2 PullRequestStatus (io.pivotal.cla.service.github.PullRequestStatus)2 SignClaPage (io.pivotal.cla.webdriver.pages.SignClaPage)2 AccessToken (io.pivotal.cla.data.AccessToken)1 CorporateSignature (io.pivotal.cla.data.CorporateSignature)1 User (io.pivotal.cla.data.User)1 Date (java.util.Date)1 WithAnonymousUser (org.springframework.security.test.context.support.WithAnonymousUser)1