use of io.pivotal.cla.security.WithSigningUser in project pivotal-cla by pivotalsoftware.
the class AccessDeniedTests method adminForbiddenForUserRequestedAdmin.
@Test
@WithSigningUser(requestedAdmin = true)
public void adminForbiddenForUserRequestedAdmin() throws Exception {
User user = WithSigningUserFactory.create();
when(mockClaRepository.findByNameAndPrimaryTrue(cla.getName())).thenReturn(cla);
when(mockGitHub.getCurrentUser(any(CurrentUserRequest.class))).thenReturn(user);
String url = AdminLinkClaPage.url();
mockMvc.perform(get(url)).andExpect(status().isForbidden());
}
use of io.pivotal.cla.security.WithSigningUser in project pivotal-cla by pivotalsoftware.
the class ClaControllerTests method learnMoreLink.
@Test
@WithSigningUser
public void learnMoreLink() {
SignClaPage home = SignClaPage.go(driver, cla.getName());
AboutPage aboutPage = home.learnMore();
aboutPage.assertAt();
}
use of io.pivotal.cla.security.WithSigningUser in project pivotal-cla by pivotalsoftware.
the class HomeControllerTests method signCcla.
@Test
@WithSigningUser
public void signCcla() {
when(mockClaRepository.findByNameAndPrimaryTrue(cla.getName())).thenReturn(cla);
SignClaPage home = HomePage.go(driver);
SignCclaPage sign = home.signCcla(SignCclaPage.class);
sign.assertAt();
}
use of io.pivotal.cla.security.WithSigningUser in project pivotal-cla by pivotalsoftware.
the class HomeControllerTests method learnMoreLink.
@Test
@WithSigningUser
public void learnMoreLink() {
SignClaPage home = HomePage.go(driver);
AboutPage aboutPage = home.learnMore();
aboutPage.assertAt();
}
use of io.pivotal.cla.security.WithSigningUser in project pivotal-cla by pivotalsoftware.
the class AdminLinkClaTests method methodSecurity.
@WithSigningUser
@Test
public void methodSecurity() {
WebDriver driver = MockMvcHtmlUnitDriverBuilder.webAppContextSetup(wac).build();
assertThatThrownBy(() -> {
AdminLinkClaPage.to(driver);
}).hasRootCauseExactlyInstanceOf(AccessDeniedException.class);
}
Aggregations