Commit 2cfcb443 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

test checking search by coordinates

parent 34db0b68
......@@ -16,10 +16,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.web.servlet.RequestBuilder;
import org.springframework.transaction.annotation.Transactional;
import lcsb.mapviewer.common.Configuration;
import lcsb.mapviewer.model.user.ConfigurationElementType;
import lcsb.mapviewer.model.user.User;
import lcsb.mapviewer.persist.dao.ConfigurationDao;
import lcsb.mapviewer.services.interfaces.IConfigurationService;
@RunWith(SpringJUnit4ClassRunner.class)
......@@ -31,15 +28,16 @@ public class DrugControllerIntegrationTest extends ControllerIntegrationTest {
private static final String TEST_ADMIN_PASSWORD = "test_admin";
private static final String TEST_ADMIN_LOGIN = "test_admin";
@Autowired
IConfigurationService configurationService;
String project_id;
@Before
public void setup() {
createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
project_id = configurationService.getConfigurationValue(ConfigurationElementType.DEFAULT_MAP);
project_id = configurationService.getConfigurationValue(ConfigurationElementType.DEFAULT_MAP);
}
@Test
......
......@@ -11,7 +11,6 @@ import org.junit.Test;
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;
......@@ -54,7 +53,7 @@ public class MapControllerIntegrationTest extends ControllerIntegrationTest {
}
@Test
public void testGetAllProjectsAsAdmin() throws Exception {
public void testGetAllElements() throws Exception {
userService.grantUserPrivilege(anonymous, PrivilegeType.READ_PROJECT, project.getProjectId());
RequestBuilder request = get("/projects/" + TEST_PROJECT + "/models/*/bioEntities/elements/")
......@@ -70,4 +69,15 @@ public class MapControllerIntegrationTest extends ControllerIntegrationTest {
assertTrue("user should be able to access elements", elements > 0);
}
@Test
public void testSearchBioEntitiesAsAdmin() throws Exception {
userService.grantUserPrivilege(anonymous, PrivilegeType.READ_PROJECT, project.getProjectId());
RequestBuilder request = get("/projects/" + TEST_PROJECT + "/models/*/bioEntities:search?coordinates=104.36,182.81")
.contentType(MediaType.APPLICATION_FORM_URLENCODED);
mockMvc.perform(request)
.andExpect(status().is2xxSuccessful());
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment