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

docs for API call fetching project source file added

parent 206eb7d7
Pipeline #18086 failed with stage
in 14 minutes and 32 seconds
......@@ -88,15 +88,22 @@ include::{snippets}/projects/project_data/update/response-body.adoc[]
=== Path Parameters
include::{snippets}/projects/project_data/delete/path-parameters.adoc[]
//=== Request Fields
//include::{snippets}/projects/project_data/delete/request-fields.adoc[]
//=== Response Fields
//include::{snippets}/projects/project_data/delete/response-fields.adoc[]
=== CURL sample
include::{snippets}/projects/project_data/delete/curl-request.adoc[]
=== Sample Response
include::{snippets}/projects/project_data/delete/response-body.adoc[]
== Get source
Gets source file used to create the project.
=== Path Parameters
include::{snippets}/projects/project_data/get_source_file/path-parameters.adoc[]
=== CURL sample
include::{snippets}/projects/project_data/get_source_file/curl-request.adoc[]
=== Sample Response
include::{snippets}/projects/project_data/get_source_file/response-body.adoc[]
......@@ -5,6 +5,9 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import java.awt.geom.Point2D;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.*;
......@@ -228,6 +231,11 @@ abstract public class ControllerIntegrationTest {
entry.setType(ProjectLogEntryType.OTHER);
entry.setContent("This is warning message");
project.addLogEntry(entry);
try {
project.setInputData(createFile(Files.readAllBytes(Paths.get("./src/test/resources/generic.xml")), userService.getUserByLogin(BUILT_IN_TEST_ADMIN_LOGIN)));
} catch (IOException e) {
e.printStackTrace();
}
ModelData map = new ModelData();
map.setName("map_name");
......
......@@ -82,6 +82,19 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest
assertEquals("admin should see all projects", projectDao.getCount(), projects);
}
@Test
public void testGetSourceFile() throws Exception {
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
createProject(TEST_PROJECT);
RequestBuilder request = get("/projects/{projectId}:downloadSource", TEST_PROJECT)
.session(session);
mockMvc.perform(request)
.andExpect(status().is2xxSuccessful())
.andDo(document("projects/project_data/get_source_file",
pathParameters(parameterWithName("projectId").description("project identifier"))));
}
@Test
public void testGetLimitedProjectsAsCurator() throws Exception {
Project project = createProject(TEST_PROJECT);
......
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