优化
This commit is contained in:
+17
@@ -67,6 +67,23 @@ class WarehouseResourceServiceTest {
|
||||
assertThat(captor.getValue().getWarehouseId()).isEqualTo(WAREHOUSE);
|
||||
}
|
||||
|
||||
@Test
|
||||
void platformPalletUsesPublicScopeAgainstAnyExistingWarehouse() {
|
||||
WarehouseEntity warehouse = warehouse();
|
||||
when(repository.findWarehouseById(WAREHOUSE)).thenReturn(warehouse);
|
||||
WarehouseLocationEntity location = new WarehouseLocationEntity();
|
||||
location.setId(30001L);
|
||||
when(repository.findLocation(0L, WAREHOUSE, 30001L)).thenReturn(location);
|
||||
|
||||
service.createPallet(0L, WAREHOUSE, new PalletRequests.SaveRequest(
|
||||
"PLT-PUBLIC", "STANDARD", null, BigDecimal.ONE, "IDLE", 30001L, null));
|
||||
|
||||
ArgumentCaptor<WarehousePalletEntity> captor = ArgumentCaptor.forClass(WarehousePalletEntity.class);
|
||||
verify(repository).insertPallet(captor.capture());
|
||||
assertThat(captor.getValue().getCustomerId()).isZero();
|
||||
assertThat(captor.getValue().getWarehouseId()).isEqualTo(WAREHOUSE);
|
||||
}
|
||||
|
||||
@Test
|
||||
void rejectsResourceAccessWhenWarehouseDoesNotBelongToTenant() {
|
||||
when(repository.warehouseOwned(TENANT, WAREHOUSE)).thenReturn(false);
|
||||
|
||||
Reference in New Issue
Block a user