Search in sources :

Example 1 with RequestValidationResult

use of edu.stanford.bmir.protege.web.server.dispatch.RequestValidationResult in project webprotege by protegeproject.

the class GetApplicationPreferencesActionHandler_TestCase method shouldCheckForPermission.

@Test
public void shouldCheckForPermission() {
    RequestValidator validator = handler.getRequestValidator(action, requestContext);
    RequestValidationResult result = validator.validateAction();
    assertThat(result.isInvalid(), is(true));
    verify(accessManager, times(1)).hasPermission(forUser(userId), ApplicationResource.get(), EDIT_APPLICATION_SETTINGS.getActionId());
}
Also used : RequestValidationResult(edu.stanford.bmir.protege.web.server.dispatch.RequestValidationResult) RequestValidator(edu.stanford.bmir.protege.web.server.dispatch.RequestValidator) Test(org.junit.Test)

Example 2 with RequestValidationResult

use of edu.stanford.bmir.protege.web.server.dispatch.RequestValidationResult in project webprotege by protegeproject.

the class UserIsSignedInValidator_TestCase method shouldNoValidateUserThatIsGuest.

@Test
public void shouldNoValidateUserThatIsGuest() {
    when(userId.isGuest()).thenReturn(true);
    RequestValidationResult result = validator.validateAction();
    assertThat(result.isValid(), is(false));
}
Also used : RequestValidationResult(edu.stanford.bmir.protege.web.server.dispatch.RequestValidationResult) Test(org.junit.Test)

Example 3 with RequestValidationResult

use of edu.stanford.bmir.protege.web.server.dispatch.RequestValidationResult in project webprotege by protegeproject.

the class CreateNewProjectActionHandler_TestCase method shouldNotAllowGuestsToCreateProjects.

@Test
public void shouldNotAllowGuestsToCreateProjects() {
    when(userId.isGuest()).thenReturn(true);
    CreateNewProjectAction action = new CreateNewProjectAction(newProjectSettings);
    RequestValidator validator = handler.getRequestValidator(action, requestContext);
    RequestValidationResult validationResult = validator.validateAction();
    assertThat(validationResult.isValid(), is(false));
}
Also used : CreateNewProjectAction(edu.stanford.bmir.protege.web.shared.project.CreateNewProjectAction) RequestValidationResult(edu.stanford.bmir.protege.web.server.dispatch.RequestValidationResult) RequestValidator(edu.stanford.bmir.protege.web.server.dispatch.RequestValidator) Test(org.junit.Test)

Example 4 with RequestValidationResult

use of edu.stanford.bmir.protege.web.server.dispatch.RequestValidationResult in project webprotege by protegeproject.

the class UserIsSignedInValidator_TestCase method shouldValidateUserThatIsNotGuest.

@Test
public void shouldValidateUserThatIsNotGuest() {
    when(userId.isGuest()).thenReturn(false);
    RequestValidationResult result = validator.validateAction();
    assertThat(result.isValid(), is(true));
}
Also used : RequestValidationResult(edu.stanford.bmir.protege.web.server.dispatch.RequestValidationResult) Test(org.junit.Test)

Aggregations

RequestValidationResult (edu.stanford.bmir.protege.web.server.dispatch.RequestValidationResult)4 Test (org.junit.Test)4 RequestValidator (edu.stanford.bmir.protege.web.server.dispatch.RequestValidator)2 CreateNewProjectAction (edu.stanford.bmir.protege.web.shared.project.CreateNewProjectAction)1