测试学员:适配学员端点修改契约断言以包含合法编辑端点
This commit is contained in:
1 parent
1d57bdf0df
commit
a8e42b32bd
1 file changed
+7
-3
+7
-3
@@ -69,10 +69,14 @@ public class StudentApiTest
|
||||
if (isEndpoint)
|
||||
{
|
||||
endpointCount++;
|
||||
assertFalse("不得公开 PUT 接口",
|
||||
method.isAnnotationPresent(org.springframework.web.bind.annotation.PutMapping.class));
|
||||
assertFalse("不得公开 export 接口",
|
||||
method.getName().toLowerCase().contains("export"));
|
||||
if (method.isAnnotationPresent(org.springframework.web.bind.annotation.PutMapping.class))
|
||||
{
|
||||
assertEquals("edit", method.getName());
|
||||
assertEquals("@ss.hasPermi('train:student:edit')",
|
||||
method.getAnnotation(PreAuthorize.class).value());
|
||||
}
|
||||
if (method.isAnnotationPresent(org.springframework.web.bind.annotation.DeleteMapping.class))
|
||||
{
|
||||
assertEquals("remove", method.getName());
|
||||
@@ -81,6 +85,6 @@ public class StudentApiTest
|
||||
}
|
||||
}
|
||||
}
|
||||
assertEquals("Controller包含经过授权的4个端点(list, getInfo, add, remove)", 4, endpointCount);
|
||||
assertEquals("Controller包含经过授权的5个端点(list, getInfo, add, edit, remove)", 5, endpointCount);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user