Commit 6509933d authored by Piotr Gawron's avatar Piotr Gawron
Browse files

documentation for listing all maps API call

parent dacc07d1
= Rest API Documentation - Project maps
Piotr Gawron
v{project-version} {build-time}
:toc: left
:sectnums:
== List maps
List all (sub)maps in a project.
=== Path Parameters
include::{snippets}/projects/project_maps/list/path-parameters.adoc[]
=== Response Fields
include::{snippets}/projects/project_maps/list/response-fields.adoc[]
=== CURL sample
include::{snippets}/projects/project_maps/list/curl-request.adoc[]
=== Sample Response
include::{snippets}/projects/project_maps/list/response-body.adoc[]
......@@ -2,8 +2,10 @@ package lcsb.mapviewer.web;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.patch;
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.*;
import static org.springframework.restdocs.payload.PayloadDocumentation.*;
import static org.springframework.restdocs.request.RequestDocumentation.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.apache.logging.log4j.LogManager;
......@@ -223,13 +225,27 @@ public class MapControllerIntegrationTest extends ControllerIntegrationTest {
ControllerIntegrationTest.BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get("/projects/*/models/")
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
.session(session);
mockMvc.perform(request)
.andExpect(status().isNotFound());
}
@Test
public void testGetMapsWithForProject() throws Exception {
MockHttpSession session = createSession(ControllerIntegrationTest.BUILT_IN_TEST_ADMIN_LOGIN,
ControllerIntegrationTest.BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get("/projects/{projectId}/models/", BUILT_IN_PROJECT).session(session);
mockMvc.perform(request)
.andExpect(status().is2xxSuccessful())
.andDo(document("projects/project_maps/list",
pathParameters(parameterWithName("projectId").description("project identifier")),
responseFields(subsectionWithPath("[]").description("list of maps").type("Array<Map>"))))
.andReturn().getResponse().getContentAsString();
}
@Test
public void testUpdateMapWithUndefinedProject() throws Exception {
MockHttpSession session = createSession(ControllerIntegrationTest.BUILT_IN_TEST_ADMIN_LOGIN,
......
Markdown is supported
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