use of org.springframework.mock.web.MockHttpSession in project dhis2-core by dhis2.
the class ApiVersionMethodTest method testMethodAll.
@Test
public void testMethodAll() throws Exception {
MockHttpSession session = getSession("ALL");
String endpoint = "/method/testAll";
mvc.perform(get(endpoint).session(session)).andExpect(status().isNotFound());
mvc.perform(get("/23" + endpoint).session(session)).andExpect(status().isNotFound());
mvc.perform(get("/24" + endpoint).session(session)).andExpect(status().isNotFound());
mvc.perform(get("/23" + endpoint + "/a").session(session)).andExpect(status().isOk());
mvc.perform(get("/24" + endpoint + "/b").session(session)).andExpect(status().isOk());
}
use of org.springframework.mock.web.MockHttpSession in project dhis2-core by dhis2.
the class ApiVersionMethodTest method testMethodAllExcludeV23.
@Test
public void testMethodAllExcludeV23() throws Exception {
MockHttpSession session = getSession("ALL");
String endpoint = "/method/testAllExcludeV23";
mvc.perform(get(endpoint).session(session)).andExpect(status().isNotFound());
mvc.perform(get("/23" + endpoint).session(session)).andExpect(status().isNotFound());
mvc.perform(get("/24" + endpoint).session(session)).andExpect(status().isNotFound());
mvc.perform(get("/23" + endpoint + "/a").session(session)).andExpect(status().isNotFound());
mvc.perform(get("/23" + endpoint + "/b").session(session)).andExpect(status().isNotFound());
mvc.perform(get("/24" + endpoint + "/a").session(session)).andExpect(status().isOk());
mvc.perform(get("/24" + endpoint + "/b").session(session)).andExpect(status().isOk());
}
use of org.springframework.mock.web.MockHttpSession in project dhis2-core by dhis2.
the class ApiVersionTypeTest method testTypeAnnotationDefault.
@Test
public void testTypeAnnotationDefault() throws Exception {
MockHttpSession session = getSession("ALL");
String endpoint = "/type/testDefault";
mvc.perform(get(endpoint).session(session)).andExpect(status().isOk());
mvc.perform(get("/23" + endpoint).session(session)).andExpect(status().isNotFound());
mvc.perform(get("/24" + endpoint).session(session)).andExpect(status().isNotFound());
}
use of org.springframework.mock.web.MockHttpSession in project dhis2-core by dhis2.
the class ApiVersionTypeTest method testTypeAnnotationV23V24.
@Test
public void testTypeAnnotationV23V24() throws Exception {
MockHttpSession session = getSession("ALL");
String endpoint = "/type/testV23V24";
mvc.perform(get(endpoint).session(session)).andExpect(status().isNotFound());
mvc.perform(get("/23" + endpoint).session(session)).andExpect(status().isOk());
mvc.perform(get("/24" + endpoint).session(session)).andExpect(status().isOk());
}
use of org.springframework.mock.web.MockHttpSession in project dhis2-core by dhis2.
the class ApiVersionTypeTest method testTypeAnnotationDefaultV23.
@Test
public void testTypeAnnotationDefaultV23() throws Exception {
MockHttpSession session = getSession("ALL");
String endpoint = "/type/testDefaultV23";
mvc.perform(get(endpoint).session(session)).andExpect(status().isOk());
mvc.perform(get("/23" + endpoint).session(session)).andExpect(status().isOk());
mvc.perform(get("/24" + endpoint).session(session)).andExpect(status().isNotFound());
}
Aggregations