Commit a8c09c06 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

tests checking if search chemicals url is working

parent cb6ee156
......@@ -6,6 +6,7 @@ import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses({ ConfigurationControllerIntegrationTest.class,
ChemicalControllerIntegrationTest.class,
CommentControllerIntegrationTest.class,
DrugControllerIntegrationTest.class,
FileControllerIntegrationTest.class,
......
package lcsb.mapviewer.web;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.Before;
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;
import org.springframework.transaction.annotation.Transactional;
import lcsb.mapviewer.model.user.ConfigurationElementType;
import lcsb.mapviewer.services.interfaces.IConfigurationService;
@RunWith(SpringJUnit4ClassRunner.class)
@Transactional
@Rollback
public class ChemicalControllerIntegrationTest extends ControllerIntegrationTest {
Logger logger = LogManager.getLogger();
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);
}
@Test
public void testSearchChemicalsInProjectUrl() throws Exception {
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
RequestBuilder request = get("/projects/" + project_id + "/chemicals:search")
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
.session(session);
mockMvc.perform(request)
.andExpect(status().is2xxSuccessful());
}
}
......@@ -44,7 +44,7 @@ public class DrugControllerIntegrationTest extends ControllerIntegrationTest {
public void testSearchDrugsInProjectUrl() throws Exception {
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
RequestBuilder request = patch("/projects/" + project_id + "/drugs:search")
RequestBuilder request = get("/projects/" + project_id + "/drugs:search")
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
.session(session);
......
......@@ -44,7 +44,7 @@ public class MiRnaControllerIntegrationTest extends ControllerIntegrationTest {
public void testSearchMiRnasInProjectUrl() throws Exception {
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
RequestBuilder request = patch("/projects/" + project_id + "/miRnas:search")
RequestBuilder request = get("/projects/" + project_id + "/miRnas:search")
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
.session(session);
......
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