Search in sources :

Example 16 with ContributorLicenseAgreement

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

the class EditAdminClaTests method editClaSuccessDescription.

@Test
public void editClaSuccessDescription() {
    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);
    AdminEditClaPage create = AdminEditClaPage.to(getDriver(), cla.getId());
    String description = "ICLA FINAL 072310";
    AdminListClasPage successPage = create.form().name("Eclipse").individual(individualMd).corporate(corporateMd).description(description).submit(AdminListClasPage.class);
    successPage.assertAt();
    ArgumentCaptor<ContributorLicenseAgreement> captor = ArgumentCaptor.forClass(ContributorLicenseAgreement.class);
    verify(mockClaRepository).save(captor.capture());
    ContributorLicenseAgreement saved = captor.getValue();
    assertThat(saved.getId()).isEqualTo(cla.getId());
    assertThat(saved.getName()).isEqualTo("Eclipse");
    assertThat(saved.isPrimary()).isFalse();
    assertThat(saved.getDescription()).isEqualTo(description);
    assertThat(saved.getIndividualContent().getHtml()).isEqualTo(individualHtml);
    assertThat(saved.getIndividualContent().getMarkdown()).isEqualTo(individualMd);
    assertThat(saved.getCorporateContent().getHtml()).isEqualTo(corporateHtml);
    assertThat(saved.getCorporateContent().getMarkdown()).isEqualTo(corporateMd);
}
Also used : AdminListClasPage(io.pivotal.cla.webdriver.pages.admin.AdminListClasPage) ContributorLicenseAgreement(io.pivotal.cla.data.ContributorLicenseAgreement) AdminEditClaPage(io.pivotal.cla.webdriver.pages.admin.AdminEditClaPage) Test(org.junit.Test)

Example 17 with ContributorLicenseAgreement

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

the class EditAdminClaTests method editClaInvalidPrimary.

@Test
public void editClaInvalidPrimary() throws Exception {
    ContributorLicenseAgreement springCla = DataUtils.createSpringCla();
    springCla.setId(54321L);
    springCla.setSupersedingCla(cla);
    when(mockClaRepository.findAll()).thenReturn(Arrays.asList(cla, springCla));
    when(mockClaRepository.findOne(cla.getId())).thenReturn(cla);
    when(mockClaRepository.findOne(springCla.getId())).thenReturn(springCla);
    when(mockClaRepository.findByNameAndPrimaryTrue(cla.getName())).thenReturn(cla);
    AdminEditClaPage create = AdminEditClaPage.to(getDriver(), springCla.getId());
    create = create.form().name(cla.getName()).primary().submit(AdminEditClaPage.class);
    ClaForm form = create.form();
    form.assertPrimary().hasError("A primary CLA with this name already exists");
}
Also used : ContributorLicenseAgreement(io.pivotal.cla.data.ContributorLicenseAgreement) AdminEditClaPage(io.pivotal.cla.webdriver.pages.admin.AdminEditClaPage) ClaForm(io.pivotal.cla.webdriver.pages.admin.AdminClaFormPage.ClaForm) Test(org.junit.Test)

Example 18 with ContributorLicenseAgreement

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

the class EditAdminClaTests method editClaSuccessPrimary.

@Test
public void editClaSuccessPrimary() {
    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);
    AdminEditClaPage create = AdminEditClaPage.to(getDriver(), cla.getId());
    AdminListClasPage successPage = create.form().name("Eclipse").individual(individualMd).corporate(corporateMd).primary().submit(AdminListClasPage.class);
    successPage.assertAt();
    ArgumentCaptor<ContributorLicenseAgreement> captor = ArgumentCaptor.forClass(ContributorLicenseAgreement.class);
    verify(mockClaRepository).save(captor.capture());
    ContributorLicenseAgreement saved = captor.getValue();
    assertThat(saved.getName()).isEqualTo("Eclipse");
    assertThat(saved.isPrimary()).isTrue();
    assertThat(saved.getIndividualContent().getHtml()).isEqualTo(individualHtml);
    assertThat(saved.getIndividualContent().getMarkdown()).isEqualTo(individualMd);
    assertThat(saved.getCorporateContent().getHtml()).isEqualTo(corporateHtml);
    assertThat(saved.getCorporateContent().getMarkdown()).isEqualTo(corporateMd);
}
Also used : AdminListClasPage(io.pivotal.cla.webdriver.pages.admin.AdminListClasPage) ContributorLicenseAgreement(io.pivotal.cla.data.ContributorLicenseAgreement) AdminEditClaPage(io.pivotal.cla.webdriver.pages.admin.AdminEditClaPage) Test(org.junit.Test)

Example 19 with ContributorLicenseAgreement

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

the class EditAdminClaTests method editClaSuccessSuperseding.

@Test
public void editClaSuccessSuperseding() {
    ContributorLicenseAgreement springCla = DataUtils.createSpringCla();
    springCla.setId(54321L);
    springCla.setSupersedingCla(cla);
    when(mockClaRepository.findAll()).thenReturn(Arrays.asList(cla, springCla));
    when(mockClaRepository.findOne(cla.getId())).thenReturn(cla);
    when(mockClaRepository.findOne(springCla.getId())).thenReturn(springCla);
    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);
    AdminEditClaPage create = AdminEditClaPage.to(getDriver(), springCla.getId());
    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 saved = captor.getValue();
    assertThat(saved.getId()).isEqualTo(springCla.getId());
    assertThat(saved.getName()).isEqualTo("Eclipse");
    assertThat(saved.isPrimary()).isFalse();
    assertThat(saved.getSupersedingCla()).isSameAs(this.cla);
    assertThat(saved.getIndividualContent().getHtml()).isEqualTo(individualHtml);
    assertThat(saved.getIndividualContent().getMarkdown()).isEqualTo(individualMd);
    assertThat(saved.getCorporateContent().getHtml()).isEqualTo(corporateHtml);
    assertThat(saved.getCorporateContent().getMarkdown()).isEqualTo(corporateMd);
}
Also used : AdminListClasPage(io.pivotal.cla.webdriver.pages.admin.AdminListClasPage) ContributorLicenseAgreement(io.pivotal.cla.data.ContributorLicenseAgreement) AdminEditClaPage(io.pivotal.cla.webdriver.pages.admin.AdminEditClaPage) Test(org.junit.Test)

Example 20 with ContributorLicenseAgreement

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

the class EditAdminClaTests method editClaSuccess.

@Test
public void editClaSuccess() {
    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);
    AdminEditClaPage create = AdminEditClaPage.to(getDriver(), cla.getId());
    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 saved = captor.getValue();
    assertThat(saved.getName()).isEqualTo("Eclipse");
    assertThat(saved.isPrimary()).isFalse();
    assertThat(saved.getDescription()).isNull();
    assertThat(saved.getSupersedingCla()).isNull();
    assertThat(saved.getIndividualContent().getHtml()).isEqualTo(individualHtml);
    assertThat(saved.getIndividualContent().getMarkdown()).isEqualTo(individualMd);
    assertThat(saved.getCorporateContent().getHtml()).isEqualTo(corporateHtml);
    assertThat(saved.getCorporateContent().getMarkdown()).isEqualTo(corporateMd);
}
Also used : AdminListClasPage(io.pivotal.cla.webdriver.pages.admin.AdminListClasPage) ContributorLicenseAgreement(io.pivotal.cla.data.ContributorLicenseAgreement) AdminEditClaPage(io.pivotal.cla.webdriver.pages.admin.AdminEditClaPage) 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