Skip to content

Commit c3abf8e

Browse files
committed
test: 修改单元测试
1 parent 4f43ac6 commit c3abf8e

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/test/java/io/github/talelin/merak/controller/cms/AdminControllerTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ public void createGroup() throws Exception {
303303
mvc.perform(post("/cms/admin/group/")
304304
.contentType(MediaType.APPLICATION_JSON).content(content))
305305
.andDo(print())
306-
.andExpect(status().isOk())
306+
.andExpect(status().isCreated())
307307
.andExpect(MockMvcResultMatchers.jsonPath("$.message").value("新建分组成功"));
308308
}
309309

@@ -384,7 +384,7 @@ public void dispatchPermission() throws Exception {
384384
mvc.perform(post("/cms/admin/permission/dispatch")
385385
.contentType(MediaType.APPLICATION_JSON).content(content))
386386
.andDo(print())
387-
.andExpect(status().isOk())
387+
.andExpect(status().isCreated())
388388
.andExpect(MockMvcResultMatchers.jsonPath("$.message").value("添加权限成功"));
389389
}
390390

@@ -414,7 +414,7 @@ public void dispatchPermissions() throws Exception {
414414
mvc.perform(post("/cms/admin/permission/dispatch/batch")
415415
.contentType(MediaType.APPLICATION_JSON).content(content))
416416
.andDo(print())
417-
.andExpect(status().isOk())
417+
.andExpect(status().isCreated())
418418
.andExpect(MockMvcResultMatchers.jsonPath("$.message").value("添加权限成功"));
419419
}
420420

@@ -447,7 +447,7 @@ public void removePermissions() throws Exception {
447447
mvc.perform(post("/cms/admin/permission/remove")
448448
.contentType(MediaType.APPLICATION_JSON).content(content))
449449
.andDo(print())
450-
.andExpect(status().isOk())
450+
.andExpect(status().isCreated())
451451
.andExpect(MockMvcResultMatchers.jsonPath("$.message").value("删除权限成功"));
452452
}
453453
}

src/test/java/io/github/talelin/merak/controller/cms/UserControllerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void register() throws Exception {
9393
mvc.perform(post("/cms/user/register")
9494
.contentType(MediaType.APPLICATION_JSON).content(content))
9595
.andDo(print())
96-
.andExpect(status().isOk())
96+
.andExpect(status().isCreated())
9797
.andExpect(MockMvcResultMatchers.
9898
jsonPath("$.message").value("注册成功"));
9999
}

src/test/java/io/github/talelin/merak/controller/v1/BookControllerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public void createBook() throws Exception {
117117
mvc.perform(post("/v1/book/")
118118
.contentType(MediaType.APPLICATION_JSON).content(content))
119119
.andDo(print())
120-
.andExpect(status().isOk())
120+
.andExpect(status().isCreated())
121121
.andExpect(MockMvcResultMatchers.
122122
jsonPath("$.message").value("新建图书成功"));
123123
}

0 commit comments

Comments
 (0)