Browse Source

IoT Hub device package delete tests: the entities of an install made before 4.4.1 belong to the tenant, as in the sibling tests

pull/16785/head
dshvaika 2 weeks ago
parent
commit
0aedc615a7
  1. 8
      application/src/test/java/org/thingsboard/server/service/iot_hub/DefaultIotHubServiceTest.java

8
application/src/test/java/org/thingsboard/server/service/iot_hub/DefaultIotHubServiceTest.java

@ -719,8 +719,11 @@ class DefaultIotHubServiceTest {
when(iotHubInstalledItemService.findByTenantId(eq(tenantId), eq(List.of("DEVICE")), isNull(), any()))
.thenReturn(new PageData<>(List.of(deleted), 1, 1, false));
// Found, so only the use-existing rule keeps it
lenient().when(dashboardService.findDashboardById(tenantId, usersDashboardId)).thenReturn(new Dashboard(usersDashboardId));
Dashboard usersDashboard = new Dashboard(usersDashboardId);
usersDashboard.setTenantId(tenantId);
lenient().when(dashboardService.findDashboardById(tenantId, usersDashboardId)).thenReturn(usersDashboard);
Device device = new Device(deviceId);
device.setTenantId(tenantId);
when(deviceService.findDeviceById(tenantId, deviceId)).thenReturn(device);
service.deleteInstalledItem(user, deleted.getId());
@ -737,6 +740,9 @@ class DefaultIotHubServiceTest {
when(iotHubInstalledItemService.findById(tenantId, checked.getId())).thenReturn(checked);
when(iotHubInstalledItemService.findByTenantId(eq(tenantId), eq(List.of("DEVICE")), isNull(), any()))
.thenReturn(new PageData<>(List.of(checked), 1, 1, false));
Dashboard usersDashboard = new Dashboard(usersDashboardId);
usersDashboard.setTenantId(tenantId);
lenient().when(dashboardService.findDashboardById(tenantId, usersDashboardId)).thenReturn(usersDashboard);
when(entityService.fetchEntityName(tenantId, usersDashboardId)).thenReturn(Optional.of("My dashboard"));
InstalledItemKeptEntities kept = service.findKeptEntities(tenantId, checked.getId());

Loading…
Cancel
Save