use of io.pivotal.cla.webdriver.pages.admin.AdminListClasPage in project pivotal-cla by pivotalsoftware.
the class AdminCreateClaTests method createClaSuccessPrimary.
@Test
public void createClaSuccessPrimary() {
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).primary().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()).isTrue();
assertThat(cla.getIndividualContent().getHtml()).isEqualTo(individualHtml);
assertThat(cla.getIndividualContent().getMarkdown()).isEqualTo(individualMd);
assertThat(cla.getCorporateContent().getHtml()).isEqualTo(corporateHtml);
assertThat(cla.getCorporateContent().getMarkdown()).isEqualTo(corporateMd);
}
use of io.pivotal.cla.webdriver.pages.admin.AdminListClasPage in project pivotal-cla by pivotalsoftware.
the class AdminCreateClaTests method createClaValidPrimary.
@Test
public void createClaValidPrimary() throws Exception {
when(mockClaRepository.findAll()).thenReturn(Arrays.asList(cla));
AdminCreateClaPage create = AdminCreateClaPage.to(getDriver());
AdminListClasPage success = create.form().name(cla.getName()).individual("Individual").corporate("Corporate").primary().submit(AdminListClasPage.class);
success.assertAt();
}
use of io.pivotal.cla.webdriver.pages.admin.AdminListClasPage in project pivotal-cla by pivotalsoftware.
the class AdminCreateClaTests method createClaSuccessDescription.
@Test
public void createClaSuccessDescription() {
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());
String description = "ICLA FINAL 072310";
AdminListClasPage successPage = create.form().name("Eclipse").individual(individualMd).corporate(corporateMd).description(description).submit(AdminListClasPage.class);
successPage.assertAt();
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()).isEqualTo(description);
assertThat(cla.getIndividualContent().getHtml()).isEqualTo(individualHtml);
assertThat(cla.getIndividualContent().getMarkdown()).isEqualTo(individualMd);
assertThat(cla.getCorporateContent().getHtml()).isEqualTo(corporateHtml);
assertThat(cla.getCorporateContent().getMarkdown()).isEqualTo(corporateMd);
}
use of io.pivotal.cla.webdriver.pages.admin.AdminListClasPage in project pivotal-cla by pivotalsoftware.
the class AdminListClaTests method listClasDelete.
@Test
public void listClasDelete() {
when(mockClaRepository.findAll()).thenReturn(Arrays.asList(cla));
AdminListClasPage listPage = AdminListClasPage.go(driver);
listPage.assertAt();
Row row = listPage.row(0);
AdminListClasPage deletePage = row.delete();
deletePage.assertAt();
verify(mockClaRepository).delete(cla.getId());
}
use of io.pivotal.cla.webdriver.pages.admin.AdminListClasPage in project pivotal-cla by pivotalsoftware.
the class AdminListClaTests method listClas.
@Test
public void listClas() {
cla.setDescription("this here");
when(mockClaRepository.findAll()).thenReturn(Arrays.asList(cla));
AdminListClasPage listPage = AdminListClasPage.go(driver);
listPage.assertAt();
Row row = listPage.row(0);
assertThat(row.getName()).isEqualTo(cla.getName());
assertThat(row.getDescription()).isEqualTo(cla.getDescription());
}
Aggregations