Search in sources :

Example 56 with WithMockUser

use of org.springframework.security.test.context.support.WithMockUser in project ranger by apache.

the class RangerKylinAuthorizerTest method adminProjectTestWithoutPermission.

/**
 * yuwen admin test_project failed
 */
@Test
@WithMockUser(username = YUWEN, roles = { ROLE_USER })
public void adminProjectTestWithoutPermission() {
    ProjectInstance project = name2Projects.get(TEST_PROJECT);
    boolean result = aclEvaluate.hasProjectAdminPermission(project);
    Assert.assertFalse(result);
}
Also used : ProjectInstance(org.apache.kylin.metadata.project.ProjectInstance) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 57 with WithMockUser

use of org.springframework.security.test.context.support.WithMockUser in project ranger by apache.

the class RangerKylinAuthorizerTest method readProjectKylinWithQueryPermission.

/**
 * yuwen read kylin_project success
 */
@Test
@WithMockUser(username = YUWEN, roles = { ROLE_USER })
public void readProjectKylinWithQueryPermission() {
    ProjectInstance project = name2Projects.get(KYLIN_PROJECT);
    boolean result = aclEvaluate.hasProjectReadPermission(project);
    Assert.assertTrue(result);
}
Also used : ProjectInstance(org.apache.kylin.metadata.project.ProjectInstance) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 58 with WithMockUser

use of org.springframework.security.test.context.support.WithMockUser in project ranger by apache.

the class RangerKylinAuthorizerTest method adminProjectTestWithAdminPermission.

/**
 * zhangqiang admin test_project success
 */
@Test
@WithMockUser(username = ZHANGQIANG, roles = { ROLE_USER })
public void adminProjectTestWithAdminPermission() {
    ProjectInstance project = name2Projects.get(TEST_PROJECT);
    boolean result = aclEvaluate.hasProjectAdminPermission(project);
    Assert.assertTrue(result);
}
Also used : ProjectInstance(org.apache.kylin.metadata.project.ProjectInstance) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 59 with WithMockUser

use of org.springframework.security.test.context.support.WithMockUser in project ranger by apache.

the class RangerKylinAuthorizerTest method adminProjectKylinWithoutPermission2.

/**
 * yuwen admin kylin_project failed
 */
@Test
@WithMockUser(username = YUWEN, roles = { ROLE_USER })
public void adminProjectKylinWithoutPermission2() {
    ProjectInstance project = name2Projects.get(KYLIN_PROJECT);
    boolean result = aclEvaluate.hasProjectAdminPermission(project);
    Assert.assertFalse(result);
}
Also used : ProjectInstance(org.apache.kylin.metadata.project.ProjectInstance) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 60 with WithMockUser

use of org.springframework.security.test.context.support.WithMockUser in project ranger by apache.

the class RangerKylinAuthorizerTest method readProjectTestWithManagementPermission.

/**
 * yuwen read test_project success
 */
@Test
@WithMockUser(username = YUWEN, roles = { ROLE_USER })
public void readProjectTestWithManagementPermission() {
    ProjectInstance project = name2Projects.get(TEST_PROJECT);
    boolean result = aclEvaluate.hasProjectReadPermission(project);
    Assert.assertTrue(result);
}
Also used : ProjectInstance(org.apache.kylin.metadata.project.ProjectInstance) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Aggregations

WithMockUser (org.springframework.security.test.context.support.WithMockUser)3415 Test (org.junit.jupiter.api.Test)2107 Test (org.junit.Test)1226 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)865 AbstractSpringIntegrationBambooBitbucketJiraTest (de.tum.in.www1.artemis.AbstractSpringIntegrationBambooBitbucketJiraTest)427 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)409 MvcResult (org.springframework.test.web.servlet.MvcResult)304 ResultActions (org.springframework.test.web.servlet.ResultActions)278 MockHttpServletRequestBuilder (org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder)275 Transactional (org.springframework.transaction.annotation.Transactional)220 WebMvcTest (org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest)179 User (io.github.jhipster.sample.domain.User)149 ModelingSubmission (de.tum.in.www1.artemis.domain.modeling.ModelingSubmission)136 ModelingExercise (de.tum.in.www1.artemis.domain.modeling.ModelingExercise)130 StudentParticipation (de.tum.in.www1.artemis.domain.participation.StudentParticipation)130 Course (de.tum.in.www1.artemis.domain.Course)124 ArrayList (java.util.ArrayList)124 Exam (de.tum.in.www1.artemis.domain.exam.Exam)114 AlertIntegrationTest (com.synopsys.integration.alert.util.AlertIntegrationTest)103 AnalysisSubmission (ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission)102