mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-22 22:21:09 +08:00
Fix reserved word columns and update field names
This commit is contained in:
@@ -35,7 +35,7 @@ class CategoryControllerTest {
|
||||
Category c = new Category();
|
||||
c.setId(1L);
|
||||
c.setName("tech");
|
||||
c.setDescribe("d");
|
||||
c.setDescription("d");
|
||||
c.setIcon("i");
|
||||
c.setSmallIcon("s1");
|
||||
Mockito.when(categoryService.createCategory(eq("tech"), eq("d"), eq("i"), eq("s1"))).thenReturn(c);
|
||||
@@ -43,10 +43,10 @@ class CategoryControllerTest {
|
||||
|
||||
mockMvc.perform(post("/api/categories")
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content("{\"name\":\"tech\",\"describe\":\"d\",\"icon\":\"i\",\"smallIcon\":\"s1\"}"))
|
||||
.content("{\"name\":\"tech\",\"description\":\"d\",\"icon\":\"i\",\"smallIcon\":\"s1\"}"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.name").value("tech"))
|
||||
.andExpect(jsonPath("$.describe").value("d"))
|
||||
.andExpect(jsonPath("$.description").value("d"))
|
||||
.andExpect(jsonPath("$.icon").value("i"))
|
||||
.andExpect(jsonPath("$.smallIcon").value("s1"));
|
||||
|
||||
@@ -60,7 +60,7 @@ class CategoryControllerTest {
|
||||
Category c = new Category();
|
||||
c.setId(2L);
|
||||
c.setName("life");
|
||||
c.setDescribe("d2");
|
||||
c.setDescription("d2");
|
||||
c.setIcon("i2");
|
||||
c.setSmallIcon("s2");
|
||||
Mockito.when(categoryService.listCategories()).thenReturn(List.of(c));
|
||||
@@ -68,7 +68,7 @@ class CategoryControllerTest {
|
||||
mockMvc.perform(get("/api/categories"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$[0].name").value("life"))
|
||||
.andExpect(jsonPath("$[0].describe").value("d2"))
|
||||
.andExpect(jsonPath("$[0].description").value("d2"))
|
||||
.andExpect(jsonPath("$[0].icon").value("i2"))
|
||||
.andExpect(jsonPath("$[0].smallIcon").value("s2"));
|
||||
}
|
||||
@@ -78,18 +78,18 @@ class CategoryControllerTest {
|
||||
Category c = new Category();
|
||||
c.setId(3L);
|
||||
c.setName("tech");
|
||||
c.setDescribe("d3");
|
||||
c.setDescription("d3");
|
||||
c.setIcon("i3");
|
||||
c.setSmallIcon("s3");
|
||||
Mockito.when(categoryService.updateCategory(eq(3L), eq("tech"), eq("d3"), eq("i3"), eq("s3"))).thenReturn(c);
|
||||
|
||||
mockMvc.perform(put("/api/categories/3")
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content("{\"name\":\"tech\",\"describe\":\"d3\",\"icon\":\"i3\",\"smallIcon\":\"s3\"}"))
|
||||
.content("{\"name\":\"tech\",\"description\":\"d3\",\"icon\":\"i3\",\"smallIcon\":\"s3\"}"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.id").value(3))
|
||||
.andExpect(jsonPath("$.name").value("tech"))
|
||||
.andExpect(jsonPath("$.describe").value("d3"))
|
||||
.andExpect(jsonPath("$.description").value("d3"))
|
||||
.andExpect(jsonPath("$.icon").value("i3"))
|
||||
.andExpect(jsonPath("$.smallIcon").value("s3"));
|
||||
}
|
||||
|
||||
@@ -54,12 +54,12 @@ class PostControllerTest {
|
||||
Category cat = new Category();
|
||||
cat.setId(1L);
|
||||
cat.setName("tech");
|
||||
cat.setDescribe("d");
|
||||
cat.setDescription("d");
|
||||
cat.setIcon("i");
|
||||
Tag tag = new Tag();
|
||||
tag.setId(1L);
|
||||
tag.setName("java");
|
||||
tag.setDescribe("td");
|
||||
tag.setDescription("td");
|
||||
tag.setIcon("ti");
|
||||
Post post = new Post();
|
||||
post.setId(1L);
|
||||
@@ -91,12 +91,12 @@ class PostControllerTest {
|
||||
Category cat = new Category();
|
||||
cat.setId(1L);
|
||||
cat.setName("tech");
|
||||
cat.setDescribe("d");
|
||||
cat.setDescription("d");
|
||||
cat.setIcon("i");
|
||||
Tag tag = new Tag();
|
||||
tag.setId(1L);
|
||||
tag.setName("java");
|
||||
tag.setDescribe("td");
|
||||
tag.setDescription("td");
|
||||
tag.setIcon("ti");
|
||||
Post post = new Post();
|
||||
post.setId(2L);
|
||||
|
||||
@@ -35,7 +35,7 @@ class TagControllerTest {
|
||||
Tag t = new Tag();
|
||||
t.setId(1L);
|
||||
t.setName("java");
|
||||
t.setDescribe("d");
|
||||
t.setDescription("d");
|
||||
t.setIcon("i");
|
||||
t.setSmallIcon("s1");
|
||||
Mockito.when(tagService.createTag(eq("java"), eq("d"), eq("i"), eq("s1"))).thenReturn(t);
|
||||
@@ -43,10 +43,10 @@ class TagControllerTest {
|
||||
|
||||
mockMvc.perform(post("/api/tags")
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content("{\"name\":\"java\",\"describe\":\"d\",\"icon\":\"i\",\"smallIcon\":\"s1\"}"))
|
||||
.content("{\"name\":\"java\",\"description\":\"d\",\"icon\":\"i\",\"smallIcon\":\"s1\"}"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.name").value("java"))
|
||||
.andExpect(jsonPath("$.describe").value("d"))
|
||||
.andExpect(jsonPath("$.description").value("d"))
|
||||
.andExpect(jsonPath("$.icon").value("i"))
|
||||
.andExpect(jsonPath("$.smallIcon").value("s1"));
|
||||
|
||||
@@ -60,7 +60,7 @@ class TagControllerTest {
|
||||
Tag t = new Tag();
|
||||
t.setId(2L);
|
||||
t.setName("spring");
|
||||
t.setDescribe("d2");
|
||||
t.setDescription("d2");
|
||||
t.setIcon("i2");
|
||||
t.setSmallIcon("s2");
|
||||
Mockito.when(tagService.listTags()).thenReturn(List.of(t));
|
||||
@@ -69,7 +69,7 @@ class TagControllerTest {
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$[0].name").value("spring"))
|
||||
.andExpect(jsonPath("$[0].describe").value("d2"))
|
||||
.andExpect(jsonPath("$[0].description").value("d2"))
|
||||
.andExpect(jsonPath("$[0].icon").value("i2"))
|
||||
.andExpect(jsonPath("$[0].smallIcon").value("s2"));
|
||||
}
|
||||
@@ -79,18 +79,18 @@ class TagControllerTest {
|
||||
Tag t = new Tag();
|
||||
t.setId(3L);
|
||||
t.setName("java");
|
||||
t.setDescribe("d3");
|
||||
t.setDescription("d3");
|
||||
t.setIcon("i3");
|
||||
t.setSmallIcon("s3");
|
||||
Mockito.when(tagService.updateTag(eq(3L), eq("java"), eq("d3"), eq("i3"), eq("s3"))).thenReturn(t);
|
||||
|
||||
mockMvc.perform(put("/api/tags/3")
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content("{\"name\":\"java\",\"describe\":\"d3\",\"icon\":\"i3\",\"smallIcon\":\"s3\"}"))
|
||||
.content("{\"name\":\"java\",\"description\":\"d3\",\"icon\":\"i3\",\"smallIcon\":\"s3\"}"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.id").value(3))
|
||||
.andExpect(jsonPath("$.name").value("java"))
|
||||
.andExpect(jsonPath("$.describe").value("d3"))
|
||||
.andExpect(jsonPath("$.description").value("d3"))
|
||||
.andExpect(jsonPath("$.icon").value("i3"))
|
||||
.andExpect(jsonPath("$.smallIcon").value("s3"));
|
||||
}
|
||||
|
||||
@@ -66,11 +66,11 @@ class ComplexFlowIntegrationTest {
|
||||
|
||||
String adminToken = registerAndLoginAsAdmin("admin", "admin@example.com");
|
||||
ResponseEntity<Map> catResp = postJson("/api/categories",
|
||||
Map.of("name", "general", "describe", "d", "icon", "i"), adminToken);
|
||||
Map.of("name", "general", "description", "d", "icon", "i"), adminToken);
|
||||
Long catId = ((Number)catResp.getBody().get("id")).longValue();
|
||||
|
||||
ResponseEntity<Map> tagResp = postJson("/api/tags",
|
||||
Map.of("name", "java", "describe", "d", "icon", "i"), adminToken);
|
||||
Map.of("name", "java", "description", "d", "icon", "i"), adminToken);
|
||||
Long tagId = ((Number)tagResp.getBody().get("id")).longValue();
|
||||
|
||||
ResponseEntity<Map> postResp = postJson("/api/posts",
|
||||
@@ -122,13 +122,13 @@ class ComplexFlowIntegrationTest {
|
||||
}
|
||||
|
||||
if (catId == null) {
|
||||
ResponseEntity<Map> catResp = postJson("/api/categories",
|
||||
Map.of("name", "general", "describe", "d", "icon", "i"), adminToken);
|
||||
ResponseEntity<Map> catResp = postJson("/api/categories",
|
||||
Map.of("name", "general", "description", "d", "icon", "i"), adminToken);
|
||||
catId = ((Number)catResp.getBody().get("id")).longValue();
|
||||
}
|
||||
|
||||
ResponseEntity<Map> tagResp = postJson("/api/tags",
|
||||
Map.of("name", "spring", "describe", "d", "icon", "i"), adminToken);
|
||||
Map.of("name", "spring", "description", "d", "icon", "i"), adminToken);
|
||||
Long tagId = ((Number)tagResp.getBody().get("id")).longValue();
|
||||
|
||||
ResponseEntity<Map> postResp = postJson("/api/posts",
|
||||
|
||||
@@ -70,11 +70,11 @@ class PublishModeIntegrationTest {
|
||||
String adminToken = registerAndLoginAsAdmin("admin", "admin@example.com");
|
||||
|
||||
ResponseEntity<Map> catResp = postJson("/api/categories",
|
||||
Map.of("name", "review", "describe", "d", "icon", "i"), adminToken);
|
||||
Map.of("name", "review", "description", "d", "icon", "i"), adminToken);
|
||||
Long catId = ((Number)catResp.getBody().get("id")).longValue();
|
||||
|
||||
ResponseEntity<Map> tagResp = postJson("/api/tags",
|
||||
Map.of("name", "t1", "describe", "d", "icon", "i"), adminToken);
|
||||
Map.of("name", "t1", "description", "d", "icon", "i"), adminToken);
|
||||
Long tagId = ((Number)tagResp.getBody().get("id")).longValue();
|
||||
|
||||
ResponseEntity<Map> postResp = postJson("/api/posts",
|
||||
|
||||
@@ -60,10 +60,10 @@ class SearchIntegrationTest {
|
||||
String admin = registerAndLoginAsAdmin("admin", "a@a.com");
|
||||
String user = registerAndLogin("bob_nice", "b@b.com");
|
||||
|
||||
ResponseEntity<Map> catResp = postJson("/api/categories", Map.of("name", "misc", "describe", "d", "icon", "i"), admin);
|
||||
ResponseEntity<Map> catResp = postJson("/api/categories", Map.of("name", "misc", "description", "d", "icon", "i"), admin);
|
||||
Long catId = ((Number)catResp.getBody().get("id")).longValue();
|
||||
|
||||
ResponseEntity<Map> tagResp = postJson("/api/tags", Map.of("name", "misc", "describe", "d", "icon", "i"), admin);
|
||||
ResponseEntity<Map> tagResp = postJson("/api/tags", Map.of("name", "misc", "description", "d", "icon", "i"), admin);
|
||||
Long tagId = ((Number)tagResp.getBody().get("id")).longValue();
|
||||
|
||||
ResponseEntity<Map> postResp = postJson("/api/posts",
|
||||
|
||||
Reference in New Issue
Block a user