Search in sources :

Example 16 with SignCclaPage

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

the class CclaControllerTests method signMailingAddressRequired.

@Test
public void signMailingAddressRequired() 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").country("USA").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().hasRequiredError();
    form.assertCountry().hasNoErrors();
    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 17 with SignCclaPage

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

the class CclaControllerTests method signFormSigned.

@Test
public void signFormSigned() throws Exception {
    List<String> organizations = Arrays.asList(corporateSignature.getGitHubOrganization());
    User user = WithSigningUserFactory.create();
    when(mockGitHub.getOrganizations(user.getGitHubLogin())).thenReturn(organizations);
    when(mockClaRepository.findByNameAndPrimaryTrue(cla.getName())).thenReturn(cla);
    when(mockCorporateSignatureRepository.findSignature(cla.getName(), organizations, user.getEmails())).thenReturn(corporateSignature);
    SignCclaPage signPage = SignCclaPage.go(getDriver(), cla.getName());
    assertThat(signPage.isSigned()).isTrue();
}
Also used : WithSigningUser(io.pivotal.cla.security.WithSigningUser) User(io.pivotal.cla.data.User) WithAnonymousUser(org.springframework.security.test.context.support.WithAnonymousUser) SignCclaPage(io.pivotal.cla.webdriver.pages.SignCclaPage) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 18 with SignCclaPage

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

the class CclaControllerTests method signCompanyNameRequired.

@Test
public void signCompanyNameRequired() 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").gitHubOrganization("pivotal").title("Director").confirm().sign(SignCclaPage.class);
    signPage.assertAt();
    form = signPage.form();
    form.assertName().hasNoErrors();
    form.assertEmail().hasNoErrors();
    form.assertCompanyName().hasRequiredError();
    form.assertGitHubOrganization().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 19 with SignCclaPage

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

the class ClaControllerTests method signCcla.

@Test
@WithSigningUser
public void signCcla() {
    SignClaPage home = SignClaPage.go(driver, cla.getName());
    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

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