提交
This commit is contained in:
+10
-10
@@ -31,20 +31,20 @@ class SmartDispatchControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void candidatesResolveSingleCustomerScopeWithoutRequestParameter() {
|
||||
when(service.resolveSingleCustomerScope()).thenReturn("100");
|
||||
when(service.candidates("100", "LMO-1", "ONT8", "PLAN")).thenReturn(List.of());
|
||||
void candidatesResolveCustomerScopeFromSelectedPlans() {
|
||||
when(service.resolveCustomerScopeForPlans(List.of(1L, 2L))).thenReturn("100");
|
||||
when(service.candidates("100", List.of(1L, 2L), "LMO-1", "ONT8", "PLAN")).thenReturn(List.of());
|
||||
|
||||
controller.candidates(platform(), "LMO-1", "ONT8", "PLAN");
|
||||
controller.candidates(platform(), List.of(1L, 2L), "LMO-1", "ONT8", "PLAN");
|
||||
|
||||
verify(service).candidates("100", "LMO-1", "ONT8", "PLAN");
|
||||
verify(service).candidates("100", List.of(1L, 2L), "LMO-1", "ONT8", "PLAN");
|
||||
}
|
||||
|
||||
@Test
|
||||
void preArrangeResolvesSingleCustomerAndAuthenticatedOperator() {
|
||||
DispatchRequests.PreArrange request = new DispatchRequests.PreArrange(
|
||||
List.of(10L, 11L), "ONT8 -> LAX9", "APT-1", "SUCCESS", "PENDING");
|
||||
when(service.resolveSingleCustomerScope()).thenReturn("100");
|
||||
when(service.resolveCustomerScopeForPallets(List.of(10L, 11L))).thenReturn("100");
|
||||
|
||||
controller.preArrange(platform(), request);
|
||||
|
||||
@@ -52,20 +52,20 @@ class SmartDispatchControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void endpointsReuseInboundOrderListAndEditAuthorities() throws Exception {
|
||||
void endpointsUseInboundOrderListAndDedicatedSmartDispatchAuthorities() throws Exception {
|
||||
PreAuthorize candidates = SmartDispatchController.class
|
||||
.getMethod("candidates", AuthenticatedUser.class, String.class, String.class, String.class)
|
||||
.getMethod("candidates", AuthenticatedUser.class, List.class, String.class, String.class, String.class)
|
||||
.getAnnotation(PreAuthorize.class);
|
||||
PreAuthorize preArrange = SmartDispatchController.class
|
||||
.getMethod("preArrange", AuthenticatedUser.class, DispatchRequests.PreArrange.class)
|
||||
.getAnnotation(PreAuthorize.class);
|
||||
|
||||
assertThat(candidates.value()).contains(OverseasPermissions.INBOUND_ORDER_LIST);
|
||||
assertThat(preArrange.value()).contains(OverseasPermissions.INBOUND_ORDER_EDIT);
|
||||
assertThat(preArrange.value()).contains(OverseasPermissions.INBOUND_ORDER_SMART_DISPATCH);
|
||||
}
|
||||
|
||||
private static AuthenticatedUser platform() {
|
||||
return new AuthenticatedUser(7L, 0L, 0L, 8L, "operator", "PLATFORM", "WEB",
|
||||
Set.of(OverseasPermissions.INBOUND_ORDER_LIST, OverseasPermissions.INBOUND_ORDER_EDIT));
|
||||
Set.of(OverseasPermissions.INBOUND_ORDER_LIST, OverseasPermissions.INBOUND_ORDER_SMART_DISPATCH));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user