Browse Source

test: audit log by TenantId and EntityId under sysadmin added.

Signed-off-by: Oleksandra Matviienko <al.zzzeebra@gmail.com>
pull/14965/head
Oleksandra Matviienko 3 days ago
parent
commit
8b494c008d
  1. 21
      application/src/test/java/org/thingsboard/server/controller/AuditLogControllerTest.java

21
application/src/test/java/org/thingsboard/server/controller/AuditLogControllerTest.java

@ -173,6 +173,27 @@ public class AuditLogControllerTest extends AbstractControllerTest {
Assert.assertEquals(11 + 1, loadedAuditLogs.size());
}
@Test
public void testAuditLogs_byTenantIdAndEntityId_Sysadmin() throws Exception {
loginSysAdmin();
//created
TenantProfile tenantProfile = new TenantProfile();
tenantProfile.setName("Profile " + UUID.randomUUID());
tenantProfile = doPost("/api/tenantProfile", tenantProfile, TenantProfile.class);
//updated
tenantProfile.setName(tenantProfile.getName() + "(old)");
tenantProfile = doPost("/api/tenantProfile", tenantProfile, TenantProfile.class);
List<AuditLog> loadedAuditLogs = getAuditLogs(5, "/api/audit/logs/entity/" +tenantProfile.getId().getEntityType()+ "/" + tenantProfile.getId().getId() + "?");
Assert.assertEquals("Audit logs count by Tenant Profile entity", 2, loadedAuditLogs.size());
//cleanup
doDelete("/api/tenantProfile/" + tenantProfile.getId().getId().toString());
}
@Test
public void whenSavingNewAuditLog_thenCheckAndCreatePartitionIfNotExists() throws ParseException {
long entityTs = ISO_8601_EXTENDED_DATETIME_TIME_ZONE_FORMAT.parse("2024-01-01T01:43:11Z").getTime();

Loading…
Cancel
Save