Skip to content
Snippets Groups Projects
Commit cc336996 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

test checking if undefined project is proper handled when listing elements

parent 1554a8c4
No related branches found
No related tags found
1 merge request!895Resolve "Curator can not set the overlay public or change the owner"
......@@ -16,8 +16,6 @@ import org.springframework.test.web.servlet.RequestBuilder;
@Rollback
public class CommentControllerIntegrationTestWithoutTransaction extends ControllerIntegrationTest {
private static final String BUILT_IN_TEST_ADMIN_PASSWORD = "admin";
private static final String BUILT_IN_TEST_ADMIN_LOGIN = "admin";
Logger logger = LogManager.getLogger();
@Before
......
......@@ -51,6 +51,9 @@ import lcsb.mapviewer.web.config.SpringWebConfig;
@ContextConfiguration(classes = SpringWebConfig.class)
abstract public class ControllerIntegrationTest {
protected static final String BUILT_IN_TEST_ADMIN_PASSWORD = "admin";
protected static final String BUILT_IN_TEST_ADMIN_LOGIN = "admin";
@Rule
public UnitTestFailedWatcher unitTestFailedWatcher = new UnitTestFailedWatcher();
protected MockMvc mockMvc;
......
......@@ -11,6 +11,7 @@ import org.junit.*;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.mock.web.MockHttpSession;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.web.servlet.RequestBuilder;
......@@ -76,6 +77,19 @@ public class MapControllerIntegrationTest extends ControllerIntegrationTest {
assertTrue("user should be able to access elements", elements > 0);
}
@Test
public void testGetAllElementsForUndefinedProject() throws Exception {
MockHttpSession session = createSession(ControllerIntegrationTest.BUILT_IN_TEST_ADMIN_LOGIN,
ControllerIntegrationTest.BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get("/projects/*/models/*/bioEntities/elements/")
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
.session(session);
mockMvc.perform(request)
.andExpect(status().isNotFound());
}
@Test
public void testSearchBioEntitiesAsAnonymous() throws Exception {
userService.grantUserPrivilege(anonymous, PrivilegeType.READ_PROJECT, project.getProjectId());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment