use of io.pivotal.cla.data.CorporateSignature in project pivotal-cla by pivotalsoftware.
the class BaseWebDriverTests method setup.
@Before
public void setup() {
driver = MockMvcHtmlUnitDriverBuilder.mockMvcSetup(mockMvc).useMockMvcForHosts("github.com").build();
MarkdownContent corporate = new MarkdownContent();
corporate.setMarkdown("# Corporate");
corporate.setHtml("[h1]Corporate[/h1]");
MarkdownContent individual = new MarkdownContent();
individual.setMarkdown("# Individual");
individual.setHtml("[h1]Individual[/h1]");
cla = new ContributorLicenseAgreement();
cla.setName("pivotal");
cla.setCorporateContent(corporate);
cla.setIndividualContent(individual);
cla.setId(1L);
individualSignature = new IndividualSignature();
individualSignature.setCla(cla);
individualSignature.setGitHubLogin("rwinch");
individualSignature.setEmail("rob@gmail.com");
individualSignature.setName("Rob Winch");
individualSignature.setMailingAddress("123 Seasame Street");
individualSignature.setTelephone("123.456.7890");
corporateSignature = new CorporateSignature();
corporateSignature.setCla(cla);
corporateSignature.setGitHubLogin("rwinch");
corporateSignature.setEmail("rob@gmail.com");
corporateSignature.setName("Rob Winch");
corporateSignature.setMailingAddress("123 Seasame Street");
corporateSignature.setTelephone("123.456.7890");
corporateSignature.setGitHubOrganization("organization");
}
use of io.pivotal.cla.data.CorporateSignature 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));
}
use of io.pivotal.cla.data.CorporateSignature in project pivotal-cla by pivotalsoftware.
the class CorporateSignatureRepositoryTests method findSignaturesForMultipleSigned.
@Test
public void findSignaturesForMultipleSigned() {
CorporateSignature springSignature = createSignature(springCla, user);
signatures.save(springSignature);
assertThat(signatures.findSignatures(new PageRequest(0, 4), Arrays.asList(signature.getGitHubOrganization(), springSignature.getGitHubOrganization()), user.getEmails())).hasSize(2);
}
use of io.pivotal.cla.data.CorporateSignature in project pivotal-cla by pivotalsoftware.
the class CorporateSignatureRepositoryTests method createSignature.
private static CorporateSignature createSignature(ContributorLicenseAgreement cla, User user) {
CorporateSignature signature = DataUtils.cclaSignature(cla);
signature.setGitHubLogin(user.getGitHubLogin());
signature.setEmail(user.getEmails().iterator().next());
return signature;
}
use of io.pivotal.cla.data.CorporateSignature in project pivotal-cla by pivotalsoftware.
the class CorporateSignatureRepositoryTests method findSignatureForMultipleSigned.
@Test
public void findSignatureForMultipleSigned() {
CorporateSignature springSignature = createSignature(springCla, user);
signatures.save(springSignature);
assertThat(signatures.findSignature(springCla.getName(), Arrays.asList(signature.getGitHubOrganization(), springSignature.getGitHubOrganization()), user.getEmails())).isNotNull();
}
Aggregations