提交
This commit is contained in:
+16
@@ -13,6 +13,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
class InboundPlanPermissionContractTest {
|
||||
private static final String LIST = "platform:overseas-warehouse:inbound-order:list";
|
||||
private static final String FBA_APPOINTMENT =
|
||||
"platform:overseas-warehouse:inbound-order:fba-appointment";
|
||||
|
||||
@Test
|
||||
void listAndDetailUseOnlyCanonicalInboundOrderListAuthority() {
|
||||
@@ -25,4 +27,18 @@ class InboundPlanPermissionContractTest {
|
||||
assertEquals("Required authority: " + LIST, method.getAnnotation(Operation.class).description());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void fbaAppointmentWritesUseDedicatedAuthority() {
|
||||
Map<String, Method> methods = Arrays.stream(InboundPlanController.class.getDeclaredMethods())
|
||||
.collect(Collectors.toMap(Method::getName, method -> method));
|
||||
|
||||
for (String name : new String[] {"batchFbaAppointment", "updateFbaAppointment"}) {
|
||||
Method method = methods.get(name);
|
||||
assertEquals("hasAuthority('" + FBA_APPOINTMENT + "')",
|
||||
method.getAnnotation(PreAuthorize.class).value());
|
||||
assertEquals("Required authority: " + FBA_APPOINTMENT,
|
||||
method.getAnnotation(Operation.class).description());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user