Search in sources :

Example 11 with ContributorLicenseAgreement

use of io.pivotal.cla.data.ContributorLicenseAgreement in project pivotal-cla by pivotalsoftware.

the class CclaControllerTests method signSupersedingCla.

@Test
public void signSupersedingCla() {
    ContributorLicenseAgreement springCla = DataUtils.createSpringCla();
    springCla.setSupersedingCla(cla);
    when(mockClaRepository.findByNameAndPrimaryTrue(springCla.getName())).thenReturn(springCla);
    when(mockClaRepository.findOne(cla.getId())).thenReturn(cla);
    SignCclaPage signPage = SignCclaPage.go(getDriver(), springCla.getName());
    signPage = signPage.form().sign(SignCclaPage.class);
    signPage.assertClaLink(springCla.getName());
    assertThat(signPage.getCorporate()).isEqualTo(cla.getCorporateContent().getHtml());
}
Also used : ContributorLicenseAgreement(io.pivotal.cla.data.ContributorLicenseAgreement) SignCclaPage(io.pivotal.cla.webdriver.pages.SignCclaPage) Test(org.junit.Test)

Example 12 with ContributorLicenseAgreement

use of io.pivotal.cla.data.ContributorLicenseAgreement in project pivotal-cla by pivotalsoftware.

the class IclaControllerTests method signSupersedingCla.

@Test
public void signSupersedingCla() {
    ContributorLicenseAgreement springCla = DataUtils.createSpringCla();
    springCla.setSupersedingCla(cla);
    when(mockClaRepository.findByNameAndPrimaryTrue(springCla.getName())).thenReturn(springCla);
    when(mockClaRepository.findOne(cla.getId())).thenReturn(cla);
    SignIclaPage signPage = SignIclaPage.go(getDriver(), springCla.getName());
    signPage = signPage.form().sign(SignIclaPage.class);
    signPage.assertClaLink(springCla.getName());
    assertThat(signPage.getIndividualCla()).isEqualTo(cla.getIndividualContent().getHtml());
}
Also used : ContributorLicenseAgreement(io.pivotal.cla.data.ContributorLicenseAgreement) SignIclaPage(io.pivotal.cla.webdriver.pages.SignIclaPage) Test(org.junit.Test)

Example 13 with ContributorLicenseAgreement

use of io.pivotal.cla.data.ContributorLicenseAgreement in project pivotal-cla by pivotalsoftware.

the class IclaControllerTests method signFormSupersedingCla.

@Test
public void signFormSupersedingCla() {
    ContributorLicenseAgreement springCla = DataUtils.createSpringCla();
    springCla.setSupersedingCla(cla);
    when(mockClaRepository.findByNameAndPrimaryTrue(springCla.getName())).thenReturn(springCla);
    SignIclaPage signPage = SignIclaPage.go(getDriver(), springCla.getName());
    signPage.assertClaLink(springCla.getName());
    assertThat(signPage.getIndividualCla()).isEqualTo(cla.getIndividualContent().getHtml());
    assertThat(signPage.isSigned()).isFalse();
}
Also used : ContributorLicenseAgreement(io.pivotal.cla.data.ContributorLicenseAgreement) SignIclaPage(io.pivotal.cla.webdriver.pages.SignIclaPage) Test(org.junit.Test)

Example 14 with ContributorLicenseAgreement

use of io.pivotal.cla.data.ContributorLicenseAgreement in project pivotal-cla by pivotalsoftware.

the class AdminCreateClaTests method createClaSuccess.

@Test
public void createClaSuccess() {
    when(mockClaRepository.findAll()).thenReturn(Arrays.asList(cla));
    when(mockClaRepository.findOne(cla.getId())).thenReturn(cla);
    String individualMd = cla.getIndividualContent().getMarkdown();
    String individualHtml = cla.getIndividualContent().getHtml();
    String corporateMd = cla.getCorporateContent().getMarkdown();
    String corporateHtml = cla.getCorporateContent().getHtml();
    String accessToken = WithAdminUserFactory.create().getAccessToken();
    when(mockGitHub.markdownToHtml(accessToken, individualMd)).thenReturn(individualHtml);
    when(mockGitHub.markdownToHtml(accessToken, corporateMd)).thenReturn(corporateHtml);
    AdminCreateClaPage create = AdminCreateClaPage.to(getDriver());
    AdminListClasPage successPage = create.form().name("Eclipse").individual(individualMd).corporate(corporateMd).submit(AdminListClasPage.class);
    successPage.assertAt();
    ArgumentCaptor<ContributorLicenseAgreement> captor = ArgumentCaptor.forClass(ContributorLicenseAgreement.class);
    verify(mockClaRepository).save(captor.capture());
    ContributorLicenseAgreement cla = captor.getValue();
    assertThat(cla.getName()).isEqualTo("Eclipse");
    assertThat(cla.isPrimary()).isFalse();
    assertThat(cla.getDescription()).isNull();
    assertThat(cla.getSupersedingCla()).isNull();
    assertThat(cla.getIndividualContent().getHtml()).isEqualTo(individualHtml);
    assertThat(cla.getIndividualContent().getMarkdown()).isEqualTo(individualMd);
    assertThat(cla.getCorporateContent().getHtml()).isEqualTo(corporateHtml);
    assertThat(cla.getCorporateContent().getMarkdown()).isEqualTo(corporateMd);
}
Also used : AdminListClasPage(io.pivotal.cla.webdriver.pages.admin.AdminListClasPage) ContributorLicenseAgreement(io.pivotal.cla.data.ContributorLicenseAgreement) AdminCreateClaPage(io.pivotal.cla.webdriver.pages.admin.AdminCreateClaPage) Test(org.junit.Test)

Example 15 with ContributorLicenseAgreement

use of io.pivotal.cla.data.ContributorLicenseAgreement in project pivotal-cla by pivotalsoftware.

the class AdminCreateClaTests method createClaSuccessSuperseding.

@Test
public void createClaSuccessSuperseding() {
    when(mockClaRepository.findAll()).thenReturn(Arrays.asList(cla));
    when(mockClaRepository.findOne(cla.getId())).thenReturn(cla);
    String individualMd = cla.getIndividualContent().getMarkdown();
    String individualHtml = cla.getIndividualContent().getHtml();
    String corporateMd = cla.getCorporateContent().getMarkdown();
    String corporateHtml = cla.getCorporateContent().getHtml();
    String accessToken = WithAdminUserFactory.create().getAccessToken();
    when(mockGitHub.markdownToHtml(accessToken, individualMd)).thenReturn(individualHtml);
    when(mockGitHub.markdownToHtml(accessToken, corporateMd)).thenReturn(corporateHtml);
    AdminCreateClaPage create = AdminCreateClaPage.to(getDriver());
    AdminListClasPage successPage = create.form().name("Eclipse").individual(individualMd).corporate(corporateMd).supersedingCla(cla.getId()).submit(AdminListClasPage.class);
    successPage.assertAt();
    ArgumentCaptor<ContributorLicenseAgreement> captor = ArgumentCaptor.forClass(ContributorLicenseAgreement.class);
    verify(mockClaRepository).save(captor.capture());
    ContributorLicenseAgreement cla = captor.getValue();
    assertThat(cla.getName()).isEqualTo("Eclipse");
    assertThat(cla.isPrimary()).isFalse();
    assertThat(cla.getSupersedingCla()).isSameAs(this.cla);
    assertThat(cla.getIndividualContent().getHtml()).isEqualTo(individualHtml);
    assertThat(cla.getIndividualContent().getMarkdown()).isEqualTo(individualMd);
    assertThat(cla.getCorporateContent().getHtml()).isEqualTo(corporateHtml);
    assertThat(cla.getCorporateContent().getMarkdown()).isEqualTo(corporateMd);
}
Also used : AdminListClasPage(io.pivotal.cla.webdriver.pages.admin.AdminListClasPage) ContributorLicenseAgreement(io.pivotal.cla.data.ContributorLicenseAgreement) AdminCreateClaPage(io.pivotal.cla.webdriver.pages.admin.AdminCreateClaPage) Test(org.junit.Test)

Aggregations

ContributorLicenseAgreement (io.pivotal.cla.data.ContributorLicenseAgreement)24 Test (org.junit.Test)14 AdminListClasPage (io.pivotal.cla.webdriver.pages.admin.AdminListClasPage)9 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)7 AdminEditClaPage (io.pivotal.cla.webdriver.pages.admin.AdminEditClaPage)6 CorporateSignature (io.pivotal.cla.data.CorporateSignature)4 AdminCreateClaPage (io.pivotal.cla.webdriver.pages.admin.AdminCreateClaPage)4 IndividualSignature (io.pivotal.cla.data.IndividualSignature)3 MarkdownContent (io.pivotal.cla.data.MarkdownContent)2 ClaPullRequestStatusRequest (io.pivotal.cla.service.ClaPullRequestStatusRequest)2 SignCclaPage (io.pivotal.cla.webdriver.pages.SignCclaPage)2 SignIclaPage (io.pivotal.cla.webdriver.pages.SignIclaPage)2 Date (java.util.Date)2 CorporateSignatureInfo (io.pivotal.cla.service.CorporateSignatureInfo)1 ClaForm (io.pivotal.cla.webdriver.pages.admin.AdminClaFormPage.ClaForm)1 Before (org.junit.Before)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1